PHP8
[m6w6/seekat] / lib / API / Call / Cache / Service / ItemPool.php
index 63f12de84fc9d7971c0265a62e9c1c3f8c3bf2e2..264cfbd173ea4414eaeeb36324333ab38a0f3c29 100644 (file)
@@ -7,8 +7,7 @@ use Psr\Cache\CacheItemInterface;
 use Psr\Cache\CacheItemPoolInterface;
 use seekat\API\Call\Cache\Service;
 
-final class ItemPool implements Service
-{
+final class ItemPool implements Service {
        /**
         * @var CacheItemPoolInterface
         */
@@ -23,6 +22,12 @@ final class ItemPool implements Service
                $this->cache = $cache;
        }
 
+       /**
+        * @param string $key
+        * @param Response|null $response
+        * @return bool
+        * @throws \Psr\Cache\InvalidArgumentException
+        */
        public function fetch(string $key, Response &$response = null) : bool {
                $this->item = $this->cache->getItem($key);
                if ($this->item->isHit()) {
@@ -37,6 +42,14 @@ final class ItemPool implements Service
                return $this->cache->save($this->item);
        }
 
+       /**
+        * @param string $key
+        * @throws \Psr\Cache\InvalidArgumentException
+        */
+       public function del(string $key) {
+               $this->cache->deleteItem($key);
+       }
+
        public function clear() {
                $this->cache->clear();
        }