mirror of
https://github.com/friendica/friendica
synced 2025-04-29 15:04:22 +02: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);
|
$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 = [];
|
$keys = [];
|
||||||
while ($key = $this->dba->fetch($stmt)) {
|
while ($key = $this->dba->fetch($stmt)) {
|
||||||
array_push($keys, $key['k']);
|
array_push($keys, $key['k']);
|
||||||
}
|
}
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
throw new CachePersistenceException(sprintf('Cannot fetch all keys with prefix %s', $prefix), $exception);
|
|
||||||
} finally {
|
|
||||||
$this->dba->close($stmt);
|
$this->dba->close($stmt);
|
||||||
|
throw new CachePersistenceException(sprintf('Cannot fetch all keys with prefix %s', $prefix), $exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->dba->close($stmt);
|
||||||
return $keys;
|
return $keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue