protected function Redis_Cache_PhpRedis::clearWithEval in Redis 7.2
1 call to Redis_Cache_PhpRedis::clearWithEval()
- Redis_Cache_PhpRedis::clear in lib/
Redis/ Cache/ PhpRedis.php - Expires data from the cache.
File
- lib/
Redis/ Cache/ PhpRedis.php, line 127
Class
- Redis_Cache_PhpRedis
- Predis cache backend.
Code
protected function clearWithEval($cid = NULL, $wildcard = FALSE) {
$client = Redis_Client::getClient();
// @todo Should I restore the clear mode?
if (NULL === $cid && FALSE === $wildcard) {
// Flush volatile keys.
// Per Drupal core definition, do not expire volatile keys
// when a default cache lifetime is set.
if (Redis_Cache_Base::LIFETIME_INFINITE == variable_get('cache_lifetime', Redis_Cache_Base::LIFETIME_DEFAULT)) {
$ret = $client
->eval(self::EVAL_DELETE_VOLATILE, array(
$this
->getKey('*'),
));
if (1 != $ret) {
trigger_error(sprintf("EVAL failed: %s", $client
->getLastError()), E_USER_ERROR);
}
}
}
else {
if ('*' !== $cid && $wildcard) {
// Flush by prefix.
$ret = $client
->eval(self::EVAL_DELETE_PREFIX, array(
$this
->getKey($cid . '*'),
));
if (1 != $ret) {
trigger_error(sprintf("EVAL failed: %s", $client
->getLastError()), E_USER_ERROR);
}
}
else {
if ('*' === $cid) {
// Flush everything.
$ret = $client
->eval(self::EVAL_DELETE_PREFIX, array(
$this
->getKey('*'),
));
if (1 != $ret) {
trigger_error(sprintf("EVAL failed: %s", $client
->getLastError()), E_USER_ERROR);
}
}
else {
if (!$wildcard) {
$client
->del($this
->getKey($cid));
}
}
}
}
}