mirror of
https://github.com/friendica/friendica
synced 2025-04-23 05:50:11 +00:00
Added Unittests for cache
fixed Lock & Cache bugs
This commit is contained in:
parent
1dafaa69c5
commit
80a4e6263f
18 changed files with 317 additions and 25 deletions
|
@ -61,7 +61,7 @@ class RedisCacheDriver extends AbstractCacheDriver implements IMemoryCacheDriver
|
|||
if ($ttl > 0) {
|
||||
return $this->redis->setex(
|
||||
$cachekey,
|
||||
time() + $ttl,
|
||||
$ttl,
|
||||
$cached
|
||||
);
|
||||
} else {
|
||||
|
@ -78,12 +78,15 @@ class RedisCacheDriver extends AbstractCacheDriver implements IMemoryCacheDriver
|
|||
return ($this->redis->delete($cachekey) > 0);
|
||||
}
|
||||
|
||||
public function clear()
|
||||
public function clear($outdated = true)
|
||||
{
|
||||
return $this->redis->flushAll();
|
||||
if ($outdated) {
|
||||
return true;
|
||||
} else {
|
||||
return $this->redis->flushAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (@inheritdoc)
|
||||
*/
|
||||
|
@ -92,7 +95,7 @@ class RedisCacheDriver extends AbstractCacheDriver implements IMemoryCacheDriver
|
|||
$cachekey = $this->getCacheKey($key);
|
||||
$cached = json_encode($value);
|
||||
|
||||
return $this->redis->setnx($cachekey, $value);
|
||||
return $this->redis->setnx($cachekey, $cached);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue