mirror of
https://github.com/friendica/friendica
synced 2025-04-23 10:30: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
|
@ -37,7 +37,7 @@ class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver
|
|||
{
|
||||
$fields = [
|
||||
'v' => serialize($value),
|
||||
'expires' => DateTimeFormat::utc('now + ' . $ttl . ' seconds'),
|
||||
'expires' => DateTimeFormat::utc('now + ' . $ttl . 'seconds'),
|
||||
'updated' => DateTimeFormat::utcNow()
|
||||
];
|
||||
|
||||
|
@ -49,8 +49,12 @@ class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver
|
|||
return dba::delete('cache', ['k' => $key]);
|
||||
}
|
||||
|
||||
public function clear()
|
||||
public function clear($outdated = true)
|
||||
{
|
||||
return dba::delete('cache', ['`expires` < NOW()']);
|
||||
if ($outdated) {
|
||||
return dba::delete('cache', ['`expires` < NOW()']);
|
||||
} else {
|
||||
return dba::delete('cache', ['`k` IS NOT NULL ']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue