/** * Give (if possible) an extra lifetime to the given cache id * * @param string $id cache id * @param int $extraLifetime * @return boolean true if ok */ public function touch($id, $extraLifetime) { list($inf) = $this->_redis->hGet(self::PREFIX_KEY . $id, self::FIELD_INF); if ($inf === '0') { $expireAt = time() + $this->_redis->ttl(self::PREFIX_KEY . $id) + $extraLifetime; return (bool) $this->_redis->expireAt(self::PREFIX_KEY . $id, $expireAt); } return false; }
/** * @see sfCache */ public function getTimeout($key) { return $_SERVER['REQUEST_TIME'] + $this->redis->ttl($this->getKey($key)); }