/** * Returns the time ( in seconds ) that remains for a cache object, * before it gets outdated. In case the cache object is already * outdated or does not exist, this method returns 0. * * @param string $id The item ID. * @param array(string=>string) $attributes Attributes that describe the * @access public * * @return int The remaining lifetime ( 0 if nonexists or outdated ). */ public function getRemainingLifetime($id, $attributes = array()) { if (!isset($this->clusterCacheFile)) { $this->clusterCacheFile = eZClusterFileHandler::instance($this->properties['location'] . $this->generateIdentifier($id, $attributes)); } $ttl = $this->options->ttl; $curTime = time(); if ($ttl !== false && $this->clusterCacheFile->exists() && !$this->clusterCacheFile->isExpired(-1, $curTime, $ttl)) { $lifetime = $curTime - $this->clusterCacheFile->mtime(); if ($lifetime < $ttl) { return $ttl - $lifetime; } } return 0; }