refactor
[m6w6/seekat] / lib / API / Call / Cache / Service / Hollow.php
diff --git a/lib/API/Call/Cache/Service/Hollow.php b/lib/API/Call/Cache/Service/Hollow.php
new file mode 100644 (file)
index 0000000..47175ff
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+namespace seekat\API\Call\Cache\Service;
+
+use http\Client\Response;
+use seekat\API\Call\Cache\Service;
+
+final class Hollow implements Service
+{
+       private $storage = [];
+
+       public function fetch(string $key, Response &$response = null) : bool {
+               if (isset($this->storage[$key])) {
+                       $response = $this->storage[$key];
+                       return true;
+               }
+               return false;
+       }
+
+       public function store(string $key, Response $response) : bool {
+               $this->storage[$key] = $response;
+               return true;
+       }
+
+       public function clear() {
+               $this->storage = [];
+       }
+
+       public function getStorage() : array {
+               return $this->storage;
+       }
+}