update to PHP-8.1
[m6w6/seekat] / lib / API / Call / Cache / Service / Hollow.php
1 <?php
2
3 namespace seekat\API\Call\Cache\Service;
4
5 use http\Client\Response;
6 use seekat\API\Call\Cache\Service;
7
8 final class Hollow implements Service {
9 private array $storage = [];
10
11 public function fetch(string $key, Response &$response = null) : bool {
12 if (isset($this->storage[$key])) {
13 $response = $this->storage[$key];
14 return true;
15 }
16 return false;
17 }
18
19 public function store(string $key, Response $response) : bool {
20 $this->storage[$key] = $response;
21 return true;
22 }
23
24 public function del(string $key) : void {
25 unset($this->storage[$key]);
26 }
27
28 public function clear() : void {
29 $this->storage = [];
30 }
31
32 public function getStorage() : array {
33 return $this->storage;
34 }
35 }