update to PHP-8.1
[m6w6/seekat] / lib / API / Call / Cache / Service / Simple.php
index 901d7aa4d8e46b6205714d75e3fefb2e20931664..45bd5fe0bc192d6aafbb457393ec7b4906f807cc 100644 (file)
@@ -6,15 +6,8 @@ use http\Client\Response;
 use Psr\SimpleCache\CacheInterface;
 use seekat\API\Call\Cache\Service;
 
-final class Simple implements Service
-{
-       /**
-        * @var CacheInterface
-        */
-       private $cache;
-
-       public function __construct(CacheInterface $cache) {
-               $this->cache = $cache;
+final class Simple implements Service {
+       public function __construct(private readonly CacheInterface $cache) {
        }
 
        public function fetch(string $key, Response &$response = null) : bool {
@@ -26,7 +19,11 @@ final class Simple implements Service
                return $this->cache->set($key, $response);
        }
 
-       public function clear() {
+       public function del(string $key) : void {
+               $this->cache->delete($key);
+       }
+
+       public function clear() : void {
                $this->cache->clear();
        }
 }