Minify_CacheInterface::isValid PHP Method

isValid() public method

Does a valid cache entry exist?
public isValid ( string $id, integer $srcMtime ) : boolean
$id string cache id (e.g. a filename)
$srcMtime integer mtime of the original source file(s)
return boolean exists
    public function isValid($id, $srcMtime);

Usage Example

Esempio n. 1
0
 /**
  * Get lessphp cache object
  *
  * @return array
  */
 private function getCache()
 {
     // cache for single run
     // so that getLastModified and getContent in single request do not add additional cache roundtrips (i.e memcache)
     if (isset($this->parsed)) {
         return $this->parsed;
     }
     // check from cache first
     $cache = null;
     $cacheId = $this->getCacheId();
     if ($this->cache->isValid($cacheId, 0)) {
         if ($cache = $this->cache->fetch($cacheId)) {
             $cache = unserialize($cache);
         }
     }
     $less = $this->getCompiler();
     $input = $cache ? $cache : $this->filepath;
     $cache = $less->cachedCompile($input);
     if (!is_array($input) || $cache['updated'] > $input['updated']) {
         $this->cache->store($cacheId, serialize($cache));
     }
     return $this->parsed = $cache;
 }
All Usage Examples Of Minify_CacheInterface::isValid