Added Unittests for cache

fixed Lock & Cache bugs
This commit is contained in:
Philipp Holzer 2018-07-07 19:46:16 +02:00
parent 1dafaa69c5
commit 80a4e6263f
No known key found for this signature in database
GPG key ID: 58160D7D6AF942B6
18 changed files with 317 additions and 25 deletions

View file

@ -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);
}
/**