Do not scan for keys just get all the keys (with prefix)
Apparently scan leads to some issues sometimes on cluster. So just use the get function to fetch the keys. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
fe5a4dd499
commit
0e66c2a38a
1 changed files with 4 additions and 6 deletions
|
@ -79,12 +79,10 @@ class Redis extends Cache implements IMemcacheTTL {
|
||||||
|
|
||||||
public function clear($prefix = '') {
|
public function clear($prefix = '') {
|
||||||
$prefix = $this->getNameSpace() . $prefix . '*';
|
$prefix = $this->getNameSpace() . $prefix . '*';
|
||||||
$it = null;
|
$keys = self::$cache->keys($prefix);
|
||||||
self::$cache->setOption(\Redis::OPT_SCAN, \Redis::SCAN_RETRY);
|
$deleted = self::$cache->del($keys);
|
||||||
while ($keys = self::$cache->scan($it, $prefix)) {
|
|
||||||
self::$cache->del($keys);
|
return count($keys) === $deleted;
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue