You are here

protected function DrupalFileCache::all in File Cache 7

List of all cache objects with specified prefix in their name.

Parameters

$cid_prefix: Prefix for cache IDs to delete.

3 calls to DrupalFileCache::all()
DrupalFileCache::delete_expired in ./filecache.inc
Delete expired cache entries.
DrupalFileCache::delete_wildcard in ./filecache.inc
Delete all cache objects witch specified prefix in their name.
DrupalFileCache::isEmpty in ./filecache.inc
Check if a cache bin is empty.

File

./filecache.inc, line 462
DrupalFileCache class that implements DrupalCacheInterface.

Class

DrupalFileCache

Code

protected function all($cid_prefix = '') {
  $list = array();
  $filename_prefix = $this
    ->encode_cid($cid_prefix);
  $filename_prefix_len = strlen($filename_prefix);
  if (is_dir($this->directory)) {
    $cwd = getcwd();
    chdir($this->directory);
    $dh = opendir('.');
    while (($filename = readdir($dh)) !== FALSE) {
      if (strncmp($filename, $filename_prefix, $filename_prefix_len) === 0) {
        $list[] = $filename;
      }
    }
    closedir($dh);
    chdir($cwd);
  }
  return $list;
}