return true if the cache has become stale - will remove stale cache entries.

@return bool
16564
public function CacheIsStale()
    {
        $cachAge = strtotime($this->fieldLastUsedDate);
        $bIsStale = ((time() - $cachAge) > TdbShopSearchCache::MAX_CACHE_AGE_IN_SECONDS);

        return $bIsStale;
    }
517111
protected function hasHit()/*# : bool */
    {
        if (!$this->trigger(CachePool::EVENT_HAS_BEFORE)) {
            return $this->setHit(false);
        }

        $meta = $this->pool->getDriver()->has($this->key);
        if (isset($meta['expire'])) {
            $this->expire = $meta['expire'];
        } else {
            return $this->setHit(false);
        }

        if (!$this->trigger(CachePool::EVENT_HAS_AFTER)) {
            return $this->setHit(false);
        }

        return $this->setHit(true);
    }
58541
public function clear()
    {
        $directory = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($this->path),
            \RecursiveIteratorIterator::SELF_FIRST
        );

        $cacheIterator = new \RegexIterator($directory, '/^.+\.cache/i', \RecursiveRegexIterator::GET_MATCH);

        $isCleared = false;

        foreach ($cacheIterator as $cacheFiles) {
            foreach ($cacheFiles as $cacheFile) {
                if (false === ($isCleared = unlink($cacheFile))) {
                    return $isCleared;
                    break;
                }
            }
        }

        return $isCleared;
    }
127200
private function isCacheExpired()
    {
        if (empty($this->cacheInterval)) {
            return true;
        }

        $cache_file = $this->cacheDirectory.'/translations/cache_timestamp';
        $cache_dir  =$this->cacheDirectory.'/translations';
        if ('\\' === DIRECTORY_SEPARATOR) {
            $cache_file = strtr($cache_file, '/', '\\');
            $cache_dir = strtr($cache_dir, '/', '\\');
        }
        if (!\is_dir($cache_dir)) {
            \mkdir($cache_dir);
        }        
        if (!\file_exists($cache_file)) {
            \touch($cache_file);
            return true;
        }
        $expired = false;
        if ((\time() - \filemtime($cache_file)) > $this->cacheInterval) {
            \file_put_contents($cache_file, \time());
            $expired = true;
        }

        return $expired;
    }
998632
public function invalidateCache(): bool
    {
        if ($this->cache !== null) {
            $this->cache->delete($this->cacheKey);
            $this->items = null;
        }

        return true;
    }
413127
public function purge() {
        if ($this->isready) {
            $this->collection->drop();
            $this->collection = $this->database->selectCollection($this->definitionhash);
        }

        return true;
    }
66583
public function purge() {
        $this->get_store()->purge();
        if ($this->get_loader()) {
            $this->get_loader()->purge();
        }
        return true;
    }
75728
public function clean() {
		if ( ! $this->enabled ) {
			return false;
		}

		$ttl      = $this->ttl;
		$max_size = $this->max_size;

		// unlink expired files
		if ( $ttl > 0 ) {
			try {
				$expire = new \DateTime();
			} catch ( \Exception $e ) {
				\WP_CLI::error( $e->getMessage() );
			}
			$expire->modify( '-' . $ttl . ' seconds' );

			$finder = $this->get_finder()->date( 'until ' . $expire->format( 'Y-m-d H:i:s' ) );
			foreach ( $finder as $file ) {
				unlink( $file->getRealPath() );
			}
		}

		// unlink older files if max cache size is exceeded
		if ( $max_size > 0 ) {
			$files = array_reverse( iterator_to_array( $this->get_finder()->sortByAccessedTime()->getIterator() ) );
			$total = 0;

			foreach ( $files as $file ) {
				if ( ( $total + $file->getSize() ) <= $max_size ) {
					$total += $file->getSize();
				} else {
					unlink( $file->getRealPath() );
				}
			}
		}

		return true;
	}
1092964
public function clear()
    {
        try {
            if (\apc_clear_cache('user')) {
                $this->_hashmap = array();

                return $this->saveHashmap();
            }
        } catch (\Exception $e) {
            $this->log('warning', sprintf('Unable to clear cache : %s', $e->getMessage()));
        }

        return false;
    }
334812
private function _isCached() 
    {
        $filters = false;

        if ($this->cacheSettings) {
        
            if ($this->cache) {
                $filters = $this->cache->getCache();
            }
        }

        return $filters;
    }
306272
public function deleteOutdated(): bool
    {
        $keys = $this->db->keys('*');
        foreach ($keys as $key) {
            try {
                $packet = $this->getPacket($key);
                if ($packet->outdated()) {
                    $this->delete($key);
                }
            } catch (BadPacketException $e) {
                $this->delete($key);
            }
        }
        return true;
    }
238152
public function expired()
    {
        // Update if empty
        if (empty($this->entries)) {
            return true;
        }

        // Check timestamps
        if ($this->timestampManager) {
            return $this->timestampManager->check($this->getTimestamp());
        }

        return false;
    }
550544
public function clearCache()
    {
        $this->_data = null;
        if ($this->frontCache instanceof Cache) {
            $this->frontCache->delete($this->cacheKey);
        }
        if ($this->cache instanceof Cache) {
            return $this->cache->delete($this->cacheKey);
        }
        return true;
    }
1337046
public function flush() {
		$pattern = $this->getCachePath() . DIRECTORY_SEPARATOR . $this->prefix . '_*';
		
		if (self::isExecAvailable()) {
			exec('rm ' . $pattern);
			return true;
		}
		
		$list = glob($pattern);
		
		if ($list === false) {
			return false;
		}
		
		if (empty($list)) {
			return true;
		}
		
		$result = true;
		
		foreach ($list as $path) {
			if (! unlink($path)) {
				$result = false;
			}
		}
		
		return $result;
	}
764944
protected function clearExpired()
    {
        if (empty($this->cache)) {
            $file = $this->directory . 'Cache.dat';

            //~ Retrieve Cache information.
            if (file_exists($file)) {
                $content = file_get_contents($file);
                if (!empty($content)) {
                    $this->cache = unserialize($content);
                } else {
                    $this->cache = array();
                }
            }
        }

        // Clean all caches have expired.
        foreach ($this->cache as $pKey => $time) {
            if ($time < time()) {
                $this->remove($pKey);
            }
        }

        return true;
    }
95749
public function clearCache()
	{
	    $path = $this->getCompiledPath();
	    if (is_dir($path)) {
	        return Dir::delete($path);
	    }
	    return true;
	}
228374
public function removeCache()
	{
		if ( ! $this->useCache || ! $this->cacheLocation ) return false;

		if ( ! is_dir( $this->cacheLocation ) ) return false;

		$rmrf = function ($dir) use ( &$rmrf )
		{
		    foreach ( glob( $dir ) as $file )
		    {
		        if ( is_dir( $file ) )
		        {
		            $rmrf( "$file/*" );
		            rmdir( $file );
		        }
		        else
		        {
		            unlink( $file );
		        }
		    }
		};

		$rmrf( $this->cacheLocation );

		return true;
	}