Clean the cache table

@param int $delay
@return bool
767736
public function clean($delay = self::CLEAN_DELAY)
    {
        $delay += self::CACHE_TIME;
        $query = $this->pdo->prepare(<<<SQL
DELETE FROM robotstxt__cache1
WHERE nextUpdate < (UNIX_TIMESTAMP() - :delay);
SQL
        );
        $query->bindValue('delay', $delay, \PDO::PARAM_INT);
        return $query->execute();
    }
298783
public function at($delay)
    {
        $absolute = is_string($delay) ? (new DateTime())->modify($delay) : $delay;
        return $this->forkWith('plannedStart', $absolute);
    }
202329
public function clearCache($olderThan=-1)
	{
		$cacheDirs = new RecursiveDirectoryIterator($this->getCacheDir());
		$cache = new RecursiveIteratorIterator($cacheDirs);
		$expired = time() - $olderThan;
		$count = 0;
		foreach ($cache as $file) {
			if ($cache->isDot() || $cache->isDir() || substr($file, -5) !== '.html') {
				continue;
			}
			if ($cache->getCTime() < $expired) {
				$count += unlink((string) $file) ? 1 : 0;
			}
		}
		return $count;
	}
3109
public function cache_prune() {
		$cache = WP_CLI::get_cache();

		if ( ! $cache->is_enabled() ) {
			WP_CLI::error( 'Cache directory does not exist.' );
		}

		$cache->prune();

		WP_CLI::success( 'Cache pruned.' );
	}
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;
	}
608255
public function clear($name = null)
    {
        $cache = $this->_getSchemaCache();
        $tables = $cache->clear($name);

        foreach ($tables as $table) {
            $this->verbose(sprintf('Cleared "%s"', $table));
        }

        $this->out('<success>Cache clear complete</success>');

        return true;
    }
536408
public static function ClearCache($CacheName = FALSE) {
      Gdn_Autoloader::SmartFree();
      if ($CacheName != 'locale') return;
      
      if (!array_key_exists($CacheName,self::$Caches))
         return self::PrepareCache($CacheName);
      
      $UseCache = (Gdn::Cache()->Type() == Gdn_Cache::CACHE_TYPE_MEMORY && Gdn::Cache()->ActiveEnabled());
      if ($UseCache) {
         $CacheKey = sprintf(Gdn_LibraryMap::CACHE_CACHE_NAME_FORMAT, $CacheName);
         $Deleted = Gdn::Cache()->Remove($CacheKey);
      } else {
         @unlink(PATH_CACHE.DS.self::$Caches[$CacheName]['ondisk']);
      }
      self::$Caches[$CacheName]['cache'] = array();
   }
584578
public function clearPaths($prefix = null)
    {
        if ((null !== $prefix) && is_string($prefix)) {
            $prefix = $this->_formatPrefix($prefix);
            if ($this->_useStaticRegistry) {
                if (isset(self::$_staticPrefixToPaths[$this->_useStaticRegistry][$prefix])) {
                    unset(self::$_staticPrefixToPaths[$this->_useStaticRegistry][$prefix]);
                    return true;
                }

                return false;
            }

            if (isset($this->_prefixToPaths[$prefix])) {
                unset($this->_prefixToPaths[$prefix]);
                return true;
            }

            return false;
        }

        if ($this->_useStaticRegistry) {
            self::$_staticPrefixToPaths[$this->_useStaticRegistry] = array();
        } else {
            $this->_prefixToPaths = array();
        }

        return true;
    }
485291
public function _clean()
    {
        $be = Kwf_Cache_Simple::getBackend();
        if ($be == 'memcache') {
            return Kwf_Cache_Simple::getMemcache()->flush();
        } else if ($be == 'file') {
            foreach (glob('cache/view/*') as $i) {
                unlink($i);
            }
            return true;
        } else {
            return self::getZendCache()->clean();
        }
    }
20159
public function clear($prefix = null)
    {
        try {
            $engine = Cache::engine($prefix);
            Cache::clear(false, $prefix);
            if ($engine instanceof ApcuEngine) {
                $this->warn("ApcuEngine detected: Cleared $prefix CLI cache successfully " .
                "but $prefix web cache must be cleared separately.");
            } elseif ($engine instanceof WincacheEngine) {
                $this->warn("WincacheEngine detected: Cleared $prefix CLI cache successfully " .
                "but $prefix web cache must be cleared separately.");
            } else {
                $this->out("<success>Cleared $prefix cache</success>");
            }
        } catch (InvalidArgumentException $e) {
            $this->abort($e->getMessage());
        }
    }
331227
public function clean()
    {
        $delay = self::OUT_OF_SYNC_TIME_LIMIT;
        $query = $this->pdo->prepare(<<<SQL
DELETE FROM robotstxt__delay0
WHERE delayUntil < ((UNIX_TIMESTAMP() - :delay) * 1000000);
SQL
        );
        $query->bindValue('delay', $delay, \PDO::PARAM_INT);
        return $query->execute();
    }
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;
	}
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;
    }
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);
    }
602240
public function release($delay = 0)
    {
        parent::release($delay);

        $this->delete();

        return $this->database->release($this->queue, $this->job, $delay);
    }
825827
public function clear($prefix = '', $skip_modules = false)
    {
        // Delete from database
        $settings_collection = new SettingEntityRepository();
        if ($prefix) {
            $settings_collection->setWherePrefix($prefix);
        }
        if ($skip_modules) {
            $settings_collection->setSkipModules();
        }

        $settings_collection->deleteObjectCollection();

        // Clear cache
        Cacher::getInstance()->getDefaultCacher()->delete(self::CACHE_KEY);

        return true;
    }
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;
    }