diff options
author | 2023-09-21 22:05:55 +0200 | |
---|---|---|
committer | 2023-09-21 22:05:55 +0200 | |
commit | 7329b83cc0fe1a5f707f864b1f3d62efd4be2172 (patch) | |
tree | 6e0a241fb8bac65b6f06327453f48ed75d2cdbf7 /caches/SQLiteCache.php | |
parent | 360f953be82b7340bd153991bdc87f699db598a4 (diff) | |
download | rss-bridge-7329b83cc0fe1a5f707f864b1f3d62efd4be2172.tar.gz rss-bridge-7329b83cc0fe1a5f707f864b1f3d62efd4be2172.tar.zst rss-bridge-7329b83cc0fe1a5f707f864b1f3d62efd4be2172.zip |
refactor: logger (#3678)
Diffstat (limited to 'caches/SQLiteCache.php')
-rw-r--r-- | caches/SQLiteCache.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/caches/SQLiteCache.php b/caches/SQLiteCache.php index 09689566..94f6e289 100644 --- a/caches/SQLiteCache.php +++ b/caches/SQLiteCache.php @@ -8,11 +8,15 @@ declare(strict_types=1); */ class SQLiteCache implements CacheInterface { - private \SQLite3 $db; + private Logger $logger; private array $config; + private \SQLite3 $db; - public function __construct(array $config) - { + public function __construct( + Logger $logger, + array $config + ) { + $this->logger = $logger; $default = [ 'file' => null, 'timeout' => 5000, @@ -59,7 +63,7 @@ class SQLiteCache implements CacheInterface $blob = $row['value']; $value = unserialize($blob); if ($value === false) { - Logger::error(sprintf("Failed to unserialize: '%s'", mb_substr($blob, 0, 100))); + $this->logger->error(sprintf("Failed to unserialize: '%s'", mb_substr($blob, 0, 100))); // delete? return $default; } @@ -68,6 +72,7 @@ class SQLiteCache implements CacheInterface // delete? return $default; } + public function set(string $key, $value, int $ttl = null): void { $cacheKey = $this->createCacheKey($key); |