mirror of
https://github.com/friendica/friendica
synced 2024-12-22 18:00:16 +00:00
Refactor DatabaseCache
This commit is contained in:
parent
0f785e8bd0
commit
b8e15b42fa
1 changed files with 6 additions and 2 deletions
|
@ -47,17 +47,21 @@ class DatabaseCache extends AbstractCache implements ICanCache
|
|||
}
|
||||
|
||||
$stmt = $this->dba->select('cache', ['k'], $where);
|
||||
} catch (\Exception $exception) {
|
||||
throw new CachePersistenceException(sprintf('Cannot fetch all keys with prefix %s', $prefix), $exception);
|
||||
}
|
||||
|
||||
try {
|
||||
$keys = [];
|
||||
while ($key = $this->dba->fetch($stmt)) {
|
||||
array_push($keys, $key['k']);
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
throw new CachePersistenceException(sprintf('Cannot fetch all keys with prefix %s', $prefix), $exception);
|
||||
} finally {
|
||||
$this->dba->close($stmt);
|
||||
throw new CachePersistenceException(sprintf('Cannot fetch all keys with prefix %s', $prefix), $exception);
|
||||
}
|
||||
|
||||
$this->dba->close($stmt);
|
||||
return $keys;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue