Empty cache for this template

@param integer $exp_time      expiration time
@return integer number of cache files deleted
550543
public function clearCache($exp_time=null)
    {
        Smarty_CacheResource::invalidLoadedCache($this->smarty);

        return $this->cached->handler->clear($this->smarty, $this->template_name, $this->cache_id, $this->compile_id, $exp_time);
    }
541611
public function get_cache_expiration() {
		$cache = get_post_meta( $this->post_id, '_inc2734_count_cache_' . $this->service_name, true );
		if ( ! empty( $cache['expiration'] ) ) {
			return date_i18n( 'm-d-Y H:i:s', $cache['expiration'] );
		}
	}
20828
public static function expire()
    {
        // #####################
        // Delete expired entries
        // #####################

        $query = 'DELETE FROM tx_metaseo_sitemap
                        WHERE is_blacklisted = 0
                          AND expire <= ' . (int)time();
        DatabaseUtility::exec($query);

        // #####################
        //  Deleted or
        // excluded pages
        // #####################
        $query = 'SELECT ts.uid
                    FROM tx_metaseo_sitemap ts
                         LEFT JOIN pages p
                            ON p.uid = ts.page_uid
                           AND p.deleted = 0
                           AND p.hidden = 0
                           AND p.tx_metaseo_is_exclude = 0
                           AND ' . DatabaseUtility::conditionNotIn('p.doktype', self::getDoktypeBlacklist()) . '
                   WHERE p.uid IS NULL';

        $deletedSitemapPages = DatabaseUtility::getColWithIndex($query);

        // delete pages
        if (!empty($deletedSitemapPages)) {
            $query = 'DELETE FROM tx_metaseo_sitemap
                            WHERE uid IN (' . implode(',', $deletedSitemapPages) . ')
                              AND is_blacklisted = 0';
            DatabaseUtility::exec($query);
        }
    }
20307
public function store($key, $value, $expiration = 0)
    {
        // $this->getTimeout(); Do delete based on the session time out
        $data = [
            'time'   => time(),
            'expire' => $expiration,
            'data'   => $value,
        ];

        if ($this->where == true) {
            $this->setCache($key)
                 ->setPath(CYGNITE_BASE.DS.toPath('public.storage.cache').DS);
        }

        if (is_array($this->getCache())) {
            $array = $this->getCache();
            $array[$key] = $data;
        } else {
            $array = [$key => $data];
        }

        $cacheData = json_encode($array);

        if ($this->getDirectory() == true) {
            @file_put_contents($this->getDirectory(), $cacheData);
        }

        return $this;
    }
835891
public function clearDisk($file = null, $exp_time = 86400)
    {
        $time_now = time();
        if(is_file($file))
        {
            $mtime = filemtime($file);
            if(!$mtime)
            {
                $this->notice("filemtime $file fail");
                return;
            }
            if($time_now - $mtime > $exp_time)
            {
                unlink($file);
            }
            return;
        }
        foreach (glob($file."/*") as $file_name) 
        {
            $this->clearDisk($file_name, $exp_time);
        }
    }
400080
public static function static_caches_cleared_since($starttime) {
        global $DB;
        $record = $DB->get_record('config', array('name'=>'scheduledtaskreset'));
        return $record && (intval($record->value) > $starttime);
    }
1338383
public function deleteExpired()
    {
        $cache = $this->loadCache();
        if (is_array($cache)) {
            $i = 0;
            $cache = array_map(function ($value) use (& $i) {
                if (!$this->isExpired($value['time'], $value['expire'])) {
                    ++$i;
                    return $value;
                }
            }, $cache);
            if ($i > 0) {
                $this->saveCache($cache);
            }
        }
        return $this;
    }
634785
public function isCached() {
		if ($this->cached) return true;

		// Passed a cacheId?
		if (!$this->cacheId) return false;

		// Cache file exists?
		if (!file_exists($this->cachePath . $this->cacheId)) return false;

		// Can get the time of the file?
		if (!($mtime = filemtime($this->cachePath . $this->cacheId))) return false;

		// Cache expired?
		if (($mtime + $this->expire) < time()) {
			unlink($this->cachePath . $this->cacheId);
			return false;
		} else {
			/**
			 * Cache the results of this isCached() call.  Why?  So
			 * we don't have to double the overhead for each template.
			 * If we didn't cache, it would be hitting the file system
			 * twice as much (file_exists() & filemtime() [twice each]).
			 */
			$this->cached = true;
			return true;
		}
	}
1295293
static function hasCompiledTemplate( $key, $timestamp, &$resourceData )
    {
        if ( !eZTemplateCompiler::isCompilationEnabled() )
            return false;
        if ( eZTemplateCompiler::alwaysGenerate() )
            return false;

        $cacheFileName = eZTemplateCompiler::compilationFilename( $key, $resourceData );

        $php = new eZPHPCreator( eZTemplateCompiler::compilationDirectory(), $cacheFileName, eZTemplateCompiler::TemplatePrefix() );
        $canRestore = $php->canRestore( $timestamp );
        $uri = false;
        if ( $canRestore )
            eZDebugSetting::writeDebug( 'eztemplate-compile', "Cache hit for uri '$uri' with key '$key'", 'eZTemplateCompiler::hasCompiledTemplate' );
        else
            eZDebugSetting::writeDebug( 'eztemplate-compile', "Cache miss for uri '$uri' with key '$key'", 'eZTemplateCompiler::hasCompiledTemplate' );
        return $canRestore;
    }
622831
function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
	{

		if (!isset($compile_id))
		$compile_id = $this->compile_id;

		if (!isset($tpl_file))
		$compile_id = null;

		$_auto_id = $this->_get_auto_id($cache_id, $compile_id);

		if (!empty($this->cache_handler_func)) {
			return call_user_func_array($this->cache_handler_func,
			array('clear', &$this, &$dummy, $tpl_file, $cache_id, $compile_id, $exp_time));
		} else {
			$_params = array('auto_base' => $this->cache_dir,
                            'auto_source' => $tpl_file,
                            'auto_id' => $_auto_id,
                            'exp_time' => $exp_time);
			require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
			return smarty_core_rm_auto($_params, $this);
		}

	}
932057
public function clearExpire()
	{
		$tableName = $this->cache->parseField($this->tableName);
		$expireField = $this->cache->parseField('expire');
		$time = time();
		return $this->cache->execute(<<<SQL
delete from {$tableName} where {$expireField} <> 0 and {$expireField} < {$time}
SQL
);
	}
149572
private function getCacheExpire($basedir)
    {
        $expire = 0;

        foreach ($this->getYmlFiles($basedir) as $file) {
            $stat = @stat($file);
            if ($expire < $stat['mtime']) {
                $expire = $stat['mtime'];
            }
        }

        $date = new \DateTime();
        if (0 !== $expire) {
            $date->setTimestamp($expire);
        }

        return $date;
    }
332544
public function setExpireMethod($expire_method)
    {
        $expire_method = strtoupper($expire_method);
        if (!isset(self::getExpungeMethods()[$expire_method])) { 
            throw new \InvalidArgumentException(sprintf('The "%s" expire method is not a valid expire method.', $expire_method));
        }
        $this->expire_method = $expire_method;
        return $this;
    }
1123045
static function canRestoreCache( $key, $timestamp, $templateFilepath )
    {
        if ( !eZTemplateTreeCache::isCacheEnabled() )
            return false;

        $templateCache =& eZTemplateTreeCache::cacheTable();
        $key = eZTemplateTreeCache::internalKey( $key );
        if ( isset( $templateCache[$key] ) )
        {
            return false;
        }
        $cacheFileName = eZTemplateTreeCache::treeCacheFilename( $key, $templateFilepath );

        $php = new eZPHPCreator( eZTemplateTreeCache::cacheDirectory(), $cacheFileName );
        return $php->canRestore( $timestamp );
    }
1191070
public function getIsExpired()
    {
        $expirationDuration = $this->getExpireDuration();
        if (empty($expirationDuration)) {
            return false;
        }

        return (time() >= ($this->createTimestamp + $expirationDuration));
    }
1236653
private function cacheIsExpired($file)
	{
		if(Config::get('@.TEMPLATE_CACHE_ON') && is_file($file))
		{
			return filemtime($file) + Config::get('@.TEMPLATE_CACHE_EXPIRE') < $_SERVER['REQUEST_TIME'];
		}
		else 
		{
			return true;
		}
	}
47607
public static function clearCache()
    {
        $expiryHandler = eZExpiryHandler::instance();
        if( $expiryHandler->hasTimestamp( ezpRestRouter::ROUTE_CACHE_KEY ) )
        {
            $expiryHandler->setTimestamp( ezpRestRouter::ROUTE_CACHE_KEY, 0 );
            $expiryHandler->store();
        }
    }