Purge all caches

@param   limit purge to subsection
@return  bool
185783
public function delete_all($section)
	{
		// determine the section index name
		$section = empty($section) ? '' : '.'.$section;

		// get the directory index
		$index = static::$redis->get($this->config['cache_id'].':dir:');
		is_null($index) or $index = $this->_unserialize($index);

		if (is_array($index))
		{
			if (!empty($section))
			{
				// limit the delete if we have a valid section
				$dirs = array();
				foreach ($index as $entry)
				{
					if ($entry == $section or strpos($entry, $section.'.') === 0)
					{
						$dirs[] = $entry;
					}
				}
			}
			else
			{
				// else delete the entire contents of the cache
				$dirs = $index;
			}

			// loop through the selected indexes
			foreach ($dirs as $dir)
			{
				// get the stored cache entries for this index
				$list = static::$redis->get($this->config['cache_id'].':index:'.$dir);
				if (is_null($list))
				{
					$list = array();
				}
				else
				{
					$list = $this->_unserialize($list);
				}

				// delete all stored keys
				foreach($list as $item)
				{
					static::$redis->del($item[0]);
				}

				// and delete the index itself
				static::$redis->del($this->config['cache_id'].':index:'.$dir);
			}

			// update the directory index
			static::$redis->set($this->config['cache_id'].':dir:', $this->_serialize(array_diff($index, $dirs)));
		}
	}
765097
public function clear()
    {
        try {
            $this->_repository
                    ->createQueryBuilder('c')
                    ->delete()
                    ->where('1 = 1')
                    ->getQuery()
                    ->execute();
            $this->resetCacheEntity();
        } catch (\Exception $e) {
            $this->log('warning', sprintf('Enable to clear cache : %s', $e->getMessage()));

            return false;
        }

        return true;
    }
1295371
def purge_cache(self):
        
        if len(self._cache) > self.max_cache_size:
            items = sorted(self._cache.items(), key=lambda (k, v): v['expiry'])
            self._cache = {k: v for k, v in items[self.max_cache_size:]
                           if not self._expired(v)}
791159
public function limit($limit = null, $offset = null)
    {
        $this->results = $this->fetch($limit, $offset);

        return $this->results->fetchAll();
    }
30651
public function purge() {
        if (class_exists('APCUIterator', false)) {
            $iterator = new APCUIterator('#^' . preg_quote($this->cacheprefix, '#') . '#');
        } else {
            $iterator = new APCIterator('user', '#^' . preg_quote($this->cacheprefix, '#') . '#');
        }
        return apcu_delete($iterator);
    }
844456
public function purge() {
        // Get all files from the cache folder
        $contents = glob($this->_storage_path . '*');

        // Remove cache files
        foreach ($contents as $content) {
            if (is_file($content)) {
                unlink($content);
            }
        }
    }
849461
public void purge(int gcBefore)
  {
    topLevel = topLevel.localDeletionTime < gcBefore ? DeletionTime.LIVE : topLevel;

    if (ranges != null)
    {
      ranges.purge(gcBefore);
      if (ranges.isEmpty())
        ranges = null;
    }
  }
550337
public static function purge(string $dir): void
	{
		if (!is_dir($dir)) {
			mkdir($dir);
		}

		/** @var SplFileInfo $entry */
		foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST) as $entry) {
			if ($entry->isDir()) {
				rmdir((string) $entry->getRealPath());
			} else {
				unlink((string) $entry->getRealPath());
			}
		}
	}
163669
private function purgeExpiredRoutes()
    {
        $expireTag = '';
        foreach ($this->routeProviders as $routeProvider) {
            /* @var $routeProvider UrlProviderInterface */
            $expireTag .= $routeProvider->getExpirationTag();
        }

        $value = md5($expireTag);

        $urlNodesCacheItem = $this->cachePool->getItem('splashExpireTag');

        if ($urlNodesCacheItem->isHit() && $urlNodesCacheItem->get() === $value) {
            return;
        }

        $this->purgeUrlsCache();

        $urlNodesCacheItem->set($value);
        $this->cachePool->save($urlNodesCacheItem);
    }
211162
public function limit($limit = null) {
		if (is_null($limit)) //remove options
			return $this->discard('query.limit');
	
		return $this->merge(['query.limit' => intval($limit)]);
	}
1341297
function reset($suffix=NULL,$lifetime=0) {
		if (!$this->dsn)
			return TRUE;
		$regex='/'.preg_quote($this->prefix.'.','/').'.+?'.
			preg_quote($suffix,'/').'/';
		$parts=explode('=',$this->dsn,2);
		switch ($parts[0]) {
			case 'apc':
			case 'apcu':
				$info=apc_cache_info('user');
				if (!empty($info['cache_list'])) {
					$key=array_key_exists('info',$info['cache_list'][0])?'info':'key';
					$mtkey=array_key_exists('mtime',$info['cache_list'][0])?
						'mtime':'modification_time';
					foreach ($info['cache_list'] as $item)
						if (preg_match($regex,$item[$key]) &&
							$item[$mtkey]+$lifetime<time())
							apc_delete($item[$key]);
				}
				return TRUE;
			case 'redis':
				$fw=Base::instance();
				$keys=$this->ref->keys($this->prefix.'.*'.$suffix);
				foreach($keys as $key) {
					$val=$fw->unserialize($this->ref->get($key));
					if ($val[1]+$lifetime<time())
						$this->ref->del($key);
				}
				return TRUE;
			case 'memcache':
				foreach (memcache_get_extended_stats(
					$this->ref,'slabs') as $slabs)
					foreach (array_filter(array_keys($slabs),'is_numeric')
						as $id)
						foreach (memcache_get_extended_stats(
							$this->ref,'cachedump',$id) as $data)
							if (is_array($data))
								foreach ($data as $key=>$val)
									if (preg_match($regex,$key) &&
										$val[1]+$lifetime<time())
										memcache_delete($this->ref,$key);
				return TRUE;
			case 'wincache':
				$info=wincache_ucache_info();
				foreach ($info['ucache_entries'] as $item)
					if (preg_match($regex,$item['key_name']) &&
						$item['use_time']+$lifetime<time())
					wincache_ucache_delete($item['key_name']);
				return TRUE;
			case 'xcache':
				return TRUE; /* Not supported */
			case 'folder':
				if ($glob=@glob($parts[1].'*'))
					foreach ($glob as $file)
						if (preg_match($regex,basename($file)) &&
							filemtime($file)+$lifetime<time())
							@unlink($file);
				return TRUE;
		}
		return FALSE;
	}
975406
public static function purgeCache()
	{
		$filePaths = static::getCacheFilePaths();

		if (file_exists($filePaths['fullPath'])) {
			$file = new \File($filePaths['path'], true);
			$file->write('');
			$file->close();
			static::refreshOpcodeCache($filePaths['fullPath']);
		}
	}
193455
final public function truncateByLimit(int $limit): bool
    {
        if (count($this->props['items']) <= $limit) {
            return false;
        }
        $this->props['items'] = array_slice($this->props['items'], 0, $limit);
        return true;
    }
832812
public function purge($maxLifetime = 1440)
	{
		$past = time() - $maxLifetime;
		$query = $this->_db->getQuery(true)
			->delete($this->_db->quoteName($this->_tbl))
			->where($this->_db->quoteName('time') . ' < ' . (int) $past);
		$this->_db->setQuery($query);

		return $this->_db->execute();
	}
153720
function clear() {
        $this->limited = true;
        $this->resetTime = \INF;
        
        while($item = \array_shift($this->queue)) {
            unset($item);
        }
        
        while($bucket = \array_shift($this->ratelimits)) {
            unset($bucket);
        }
        
        $this->limited = false;
        $this->resetTime = 0;
    }
213939
public function purgeOldCache()
    {
        $cache_dir = dirname($this->cache_dir);
        $current = basename($this->cache_dir);
        $count = 0;

        foreach (new \DirectoryIterator($cache_dir) as $file) {
            $dir = $file->getBasename();
            if ($dir === $current || $file->isDot() || $file->isFile()) {
                continue;
            }

            Folder::delete($file->getPathname());
            $count++;
        }

        return $count;
    }
807982
public function purge() {
        // delete trash and spam
        if ($this->folder==$this->getTrash() || strtolower($this->folder)=="spam") {
            if (imap_delete($this->imap,'1:*') === false) {
                return false;
            }
            return imap_expunge($this->imap);

            // move others to trash
        } else {
            if (imap_mail_move($this->imap,'1:*', $this->getTrash()) == false) {
                return false;
            }
            return imap_expunge($this->imap);
        }
    }