Rebuild the cache, check to see if it's still valid and rebuild if it's outdated.
431968
public function rebuild()
    {
        if ($this->tracker->isOutdated()) {
            $this->logger->info('[Webpack 1/2]: Compiling assets.');
            $output = $this->compiler->compile();
            $this->logger->debug($output);

            $this->logger->info('[Webpack 2/2]: Dumping assets.');
            $this->dumper->dump();
        } else {
            $this->logger->info('[Webpack]: Cache still up-to-date.');
        }
    }
1031103
def exists(config):
    
    exists = (
        pathlib.Path(config.cache_path).exists()
        and pathlib.Path(config.cache_path).is_dir()
    )
    if not exists:
        return False
    index_path = pathlib.Path(config.cache_path) / "index.json"
    if index_path.exists():
        with open(index_path, "r") as out:
            index = json.load(out)
        if index["version"] != __version__:
            # TODO: Inspect the versions properly.
            logger.warning(
                "Wily cache is old, you may incur errors until you rebuild the cache."
            )
    else:
        logger.warning(
            "Wily cache was not versioned, you may incur errors until you rebuild the cache."
        )
        create_index(config)
    return True
1040926
def needs_update(self, cache_key):
    
    if not self.cacheable(cache_key):
      # An uncacheable CacheKey is always out of date.
      return True

    return self._read_sha(cache_key) != cache_key.hash
1086197
public function rebuild()
    {
        $this->apply(function($config) {
            $this->rebuildCacheRecord($config, $this->model, 'SUM', $config['columnToSum']);
        });
    }
844113
private function _checkAndBuildStructure()
    {
        if (!($this->_structureChecked)) {
            if (!$this->_checkStructureVersion()) {
                $this->_buildStructure();
                if (!$this->_checkStructureVersion()) {
                    Zend_Cache::throwException("Impossible to build cache structure in " . $this->_options['cache_db_complete_path']);
                }
            }
            $this->_structureChecked = true;
        }
        return true;
    }
355146
public function needsReload()
    {
        if ($this->reload) {
            return true;
        }

        // will reload tld list if timestamp of cache file is outdated
        if (time() - $this->tldList['timestamp'] > $this->cacheTime) {
            return true;
        }

        // will reload tld list if changes to Additional.php have been made
        if ($this->tldList['timestamp'] < filemtime(__DIR__ .'/Additional.php')) {
            return true;
        }

        return false;
    }
1333506
public function updateCache()
    {
        if ($this->updateAttempted) {
            return;
        }
        $this->updateAttempted = true;

        $this->metadata = $this->downloadMetadata();
        if ($this->metadata === null) {
            return;
        }

        $expires = time() + 24*60*60; // Default expires in one day

        if ($this->metadata->validUntil !== null && $this->metadata->validUntil < $expires) {
            $expires = $this->metadata->validUntil;
        }

        $metadataSerialized = serialize($this->metadata);

        $this->aggregator->addCacheItem($this->cacheId, $metadataSerialized, $expires, $this->cacheTag);
    }
398148
def ensure_cache_folder(self):
    
    if os.path.exists(self.cache_folder) is False:
      os.makedirs(self.cache_folder)
1228429
def check_cache(self, template):
        '''
        
        '''
        if template not in self.cached:
            self.cache_file(template)
            self.cached.append(template)
984852
private function isCacheUpToDate()
    {
        if (!file_exists($this->cachedFile)) {
            return false;
        }

        $cacheTime = filemtime($this->cachedFile);
        $mTime     = $this->modificationTime();

        return $cacheTime == $mTime;
    }
77514
protected function checkCacheVersion()
    {
        $fileName = $this->getVersionFileName();

        if (!file_exists($fileName)) {
            return false;
        }

        $version = md5($this->boltVersion);
        $cached = file_get_contents($fileName);

        if ($version === $cached) {
            return true;
        }
        $this->versionChange = true;

        return false;
    }
916852
public function rebuild()
	{
		// Get an instance of the table object.
		$table = $this->getTable();

		if (!$table->rebuild())
		{
			$this->setError($table->getError());

			return false;
		}

		// Clear the cache
		$this->cleanCache();

		return true;
	}
404187
public function refreshCache()
    {
        $app = Facade::getFacadeApplication();
        $cache = $app->make('cache/request');
        if ($cache->isEnabled()) {
            $cache->delete('page/'.$this->getCollectionID());
        }
    }
1119342
def maybeUpdate(self):
        
        if self.wasModified():
            self.lastModified = self.filePath.getmtime()
            self.fileContents = self.filePath.getContent()
            self.hashValue = hashlib.sha1(self.fileContents).hexdigest()
526031
def isDirty(self, CachableItem):
        """"""
        _cachedItem = self.get(CachableItem)
        if not _cachedItem:
            return True
        _newCacheItem = self.mapper.get(CachableItem)
        return False if _cachedItem == _newCacheItem else True
949564
private void cleanup() {
		CacheEntry oldest = null;
		_count = 0;

		// Cleanup obsolete entries and find the oldest
		for (Map.Entry<String, CacheEntry> e : _cache.entrySet()) {
			String key = e.getKey();
			CacheEntry entry = e.getValue();
			// Remove obsolete entry
			if (entry.isExpired()) {
				_cache.remove(key);
			}
			// Count the remaining entry
			else {
				_count++;
				if (oldest == null || oldest.getExpiration() > entry.getExpiration())
					oldest = entry;
			}
		}

		// Remove the oldest if cache size exceeded maximum
		if (_count > _maxSize && oldest != null) {
			_cache.remove(oldest.getKey());
			_count--;
		}
	}
913881
def _cache_is_expired():
        """"""
        now = timezone.now()
        timediff = TransCache.SINGLETON_CREATION_DATETIME - now
        return (timediff.total_seconds() > TransCache.SINGLETON_EXPIRATION_MAX_SECONDS)