Prune one of the named caches by removing 20% of the cache if it is full

@param string $cache Type of cache to prune
482831
protected function pruneCache($cache)
    {
        if (count($this->cache[$cache]) == $this->maxCacheSize) {
            $this->cache[$cache] = array_slice($this->cache[$cache], $this->maxCacheSize * 0.2);
        }
    }
104564
public function evaluateDependency($cache): void
    {
        foreach ($this->dependencies as $dependency) {
            $dependency->evaluateDependency($cache);
        }
    }
1310907
public function cacheReset($key = null) {
        if (is_null($key)) {
            $this->_cache = array();
        } else {
            unset($this->_cache[$key]);
        }
    }
259118
public function remove($key)
    {
        $key = strtr(strtolower($key), '_', '-');

        unset($this->headers[$key]);

        if ('cache-control' === $key) {
            $this->cacheControl = array();
        }
    }
1137683
public function clear($cache = null)
    {
        if ($cache === null) {
            $cache = $this->cache_name;
        }
        $cache = self::encodeCache($cache);
        $url = "projects/{$this->project_id}/caches/$cache/clear";
        $params = array();
        $this->setJsonHeaders();
        return self::json_decode($this->apiCall(self::POST, $url, $params));
    }
4514
public function deleteFromCache($key)
  {
    $file = $this->cachePath . $this->getEncodedKey($key);
    if (file_exists($file)) {
      unlink($file);
    }
  }
586038
public static function clear($key)
    {
        $that = new static($key);

        if ($that->isCached()) {

            $deletionSuccess = unlink($that->filePath());
            
            if(!$deletionSuccess) {
                throw new CacheException(sprintf("Could not delete file '%s'", $this->filePath()));
            }
        }
    }
1043876
protected void removeFromCache(String cacheName, String key) {
        try {
            ICache cache = getCache(cacheName);
            if (cache != null) {
                cache.delete(key);
            }
        } catch (CacheException e) {
            LOGGER.warn(e.getMessage(), e);
        }
    }
1249024
public function setCache(\Doctrine\Common\Cache\Cache $cache) {
		$this->cache = $cache;
		return $this;
	}
1160911
public function setCache($cache)
    {
        if ($cache instanceof Cache ||
            (class_exists('\Doctrine\Common\Cache\CacheProvider') && $cache instanceof \Doctrine\Common\Cache\CacheProvider)
        ) {
            $this->cache = $cache;
            return;
        }

        throw new \Exception('Cache not supported');
    }
1360522
public function cleanup($size, $rate)
    {
        // Check if cache size exceeds cache limit
        if (($cacheSize = (int) file_get_contents($this->storage)) <= $size) {
            return false;
        }

        // Cache size exceeds limit, so we build a sorted list of all files in
        // the cache - may take quite some time.
        clearstatcache();
        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($this->root, \RecursiveDirectoryIterator::CURRENT_AS_FILEINFO)
        );

        $ctimes   = array();
        $filedata = array();
        foreach ($iterator as $file) {
            if ($file->isFile() &&
                 ($file->getFilename() !== basename($this->storage)))
            {
                $ctimes[]   = $file->getCTime();
                $filedata[] = array(realpath($file->getPathname()), $file->getSize());
            }
        }

        // Sort the file data depending on the ctimes
        array_multisort(
            $ctimes, SORT_NUMERIC, SORT_ASC,
            $filedata
        );

        // Remove files until we reached the maximum cache size
        $maxSize = $size * $rate;
        $reduced = 0;
        foreach ($filedata as $file) {
            $reduced += $file[1];
            unlink($file[0]);

            // Abort deletion loop, if we reached the lower border
            if (($cacheSize - $reduced) < $maxSize) {
                break;
            }
        }

        // Write new cache size to storage file
        file_put_contents($this->storage, file_get_contents($this->storage) - $reduced);
    }
315519
private function _deleteCache()
    {
        if ($this->_cache instanceof \Zend_Cache_Core) {
            $this->_cache->remove($this->_cacheid);
            $this->_cache->remove($this->_cacheid . 'trans');
        }
    }
340158
public function delete($key)
    {
        if (true === array_key_exists($key, $this->cache)) {
            unset($this->cache[$key]);

            return true;
        }

        return false;
    }
1374363
function clear($key) {
		// Normalize array literal
		$cache=Cache::instance();
		$parts=$this->cut($key);
		if ($key=='CACHE')
			// Clear cache contents
			$cache->reset();
		elseif (preg_match('/^(GET|POST|COOKIE)\b(.+)/',$key,$expr)) {
			$this->clear('REQUEST'.$expr[2]);
			if ($expr[1]=='COOKIE') {
				$parts=$this->cut($key);
				$jar=$this->hive['JAR'];
				unset($jar['lifetime']);
				$jar['expire']=0;
				call_user_func_array('setcookie',
					array_merge([$parts[1],NULL],$jar));
				unset($_COOKIE[$parts[1]]);
			}
		}
		elseif ($parts[0]=='SESSION') {
			if (!headers_sent() && session_status()!=PHP_SESSION_ACTIVE)
				session_start();
			if (empty($parts[1])) {
				// End session
				session_unset();
				session_destroy();
				$this->clear('COOKIE.'.session_name());
			}
			$this->sync('SESSION');
		}
		if (!isset($parts[1]) && array_key_exists($parts[0],$this->init))
			// Reset global to default value
			$this->hive[$parts[0]]=$this->init[$parts[0]];
		else {
			eval('unset('.$this->compile('@this->hive.'.$key).');');
			if ($parts[0]=='SESSION') {
				session_commit();
				session_start();
			}
			if ($cache->exists($hash=$this->hash($key).'.var'))
				// Remove from cache
				$cache->clear($hash);
		}
	}
106596
public function removeCacheControlDirective(string $key)
    {
        unset($this->cacheControl[$key]);
        $this->owner->getHeaders()->set('Cache-Control', $this->getCacheControlHeader());
    }
1005555
public function delete($key) 
    {
        $this->stats['execTimes'] ++;
        unset($this->temp[$key]);
        
        $file = $this->getCachePath($key);
        
        clearstatcache();
        if(is_file($file)) {
            $this->waitUnlock($key);
            $this->lock($key);
            @unlink($file);
            $this->unlock($key);
        }
    }
674006
private function pruneNodeCache(): void
    {
        if ($this->maxItems > 0 && count($this->nodes) > $this->maxItems) {
            $this->nodes = array_slice($this->nodes, (int)($this->maxItems * 0.2), null, true);
        }
    }