protected function Redis_Cache_Predis::clearWithEval in Redis 7.2
1 call to Redis_Cache_Predis::clearWithEval()
- Redis_Cache_Predis::clear in lib/
Redis/ Cache/ Predis.php - Expires data from the cache.
File
- lib/
Redis/ Cache/ Predis.php, line 132
Class
- Redis_Cache_Predis
- 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, 0, $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, 0, $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, 0, $this
->getKey('*'));
if (1 != $ret) {
trigger_error(sprintf("EVAL failed: %s", $client
->getLastError()), E_USER_ERROR);
}
}
else {
if (!$wildcard) {
$client
->del($this
->getKey($cid));
}
}
}
}
}