function DrupalAPCCache::clear in APC - Alternative PHP Cache 7
Expires data from the cache.
If called without arguments, expirable entries will be cleared from the cache_page and cache_block bins.
Parameters
$cid: If set, the cache ID or an array of cache IDs. Otherwise, all cache entries that can expire are deleted. The $wildcard argument will be ignored if set to NULL.
$wildcard: If TRUE, the $cid argument must contain a string value and cache IDs starting with $cid are deleted in addition to the exact cache ID specified by $cid. If $wildcard is TRUE and $cid is '*', the entire cache is emptied.
Overrides DrupalCacheInterface::clear
File
- ./
drupal_apc_cache.inc, line 260 - This integrates the drupal APC cache backend.
Class
- DrupalAPCCache
- APC cache implementation.
Code
function clear($cid = NULL, $wildcard = FALSE) {
if ($this->drush) {
self::$remoteClears[$this->bin][serialize($cid)] = $wildcard;
// APC uses separate storage for CLI mode, bounce the clear request back
// into this method on all server nodes via XMLRPC.
return;
}
// Add a get to our statistics.
$GLOBALS['apc_statistics'][] = array(
'clear',
$this->bin,
$cid,
(int) $wildcard,
);
if (empty($cid)) {
$this
->flush();
}
else {
if ($wildcard) {
if ($cid == '*') {
$this
->flush();
}
else {
$this
->deletePrefix($cid);
}
}
else {
if (is_array($cid)) {
foreach ($cid as $entry) {
apc_delete($this
->key($entry));
}
}
else {
apc_delete($this
->key($cid));
}
}
}
}