X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fseekat;a=blobdiff_plain;f=lib%2FAPI%2FCall%2FCache%2FService%2FItemPool.php;fp=lib%2FAPI%2FCall%2FCache%2FService%2FItemPool.php;h=63f12de84fc9d7971c0265a62e9c1c3f8c3bf2e2;hp=0000000000000000000000000000000000000000;hb=2451d97f1cb7b97e445b4dd839835b8673a4d0fc;hpb=3958595e9ff27162ae918db1453ddecd4840d481 diff --git a/lib/API/Call/Cache/Service/ItemPool.php b/lib/API/Call/Cache/Service/ItemPool.php new file mode 100644 index 0000000..63f12de --- /dev/null +++ b/lib/API/Call/Cache/Service/ItemPool.php @@ -0,0 +1,43 @@ +cache = $cache; + } + + public function fetch(string $key, Response &$response = null) : bool { + $this->item = $this->cache->getItem($key); + if ($this->item->isHit()) { + $response = $this->item->get(); + return true; + } + return false; + } + + public function store(string $key, Response $response) : bool { + $this->item->set($response); + return $this->cache->save($this->item); + } + + public function clear() { + $this->cache->clear(); + } +}