src/M6Web/Component/Redis/Cache.php
public function expire($key, $ttl)
    {
        if ($ttl <= 0) {
            throw new Exception('ttl arg cant be negative');
        }

        $keyP = $this->getPatternKey().$key;
        $func = function ($redis) use ($keyP, $ttl) {
            try {
                $start = microtime(true);
                $ret = $redis->expire($keyP, $ttl);
                $this->notifyEvent('expire', array($keyP, $ttl), microtime(true) - $start);

                return $ret;
            } catch (Predis\ServerException $e) {
                return null;
            }
        };

        // gestion du multi
        if (true === $this->multi) {
            $this->addToExecList($key, $func);

            return $this;
        } else {
            $ret = $func($this->getRedis($key));

            return $ret;
        }
    }
public function expire($key, $ttl)
    {
        if ($ttl <= 0) {
            throw new Exception('ttl arg cant be negative');
        }

        $keyP = $this->getPatternKey().$key;
        $func = function ($redis) use ($keyP, $ttl) {
            try {
                $start = microtime(true);
                $ret = $redis->expire($keyP, $ttl);
                $this->notifyEvent('expire', array($keyP, $ttl), microtime(true) - $start);

                return $ret;
            } catch (Predis\ServerException $e) {
                return null;
            }
        };

        // gestion du multi
        if (true === $this->multi) {
            $this->addToExecList($key, $func);

            return $this;
        } else {
            $ret = $func($this->getRedis($key));

            return $ret;
        }
    }
set the key ttl

@param string  $key la clé
@param integer $ttl ttl en seconde

@throws Exception
@return int