4 require_once __DIR__
. "/../vendor/autoload.php";
7 $redis->connect("localhost");
8 $redis->setOption(Redis
::OPT_SERIALIZER
, Redis
::SERIALIZER_PHP
);
9 $cache = new class($redis) implements \seekat\API\Call\Cache\Service
{
10 function __construct(private readonly Redis
$redis) {
12 function clear() : void
{
13 $this->redis
->flushDB();
15 function fetch(string $key, \http\Client\Response
&$response = null): bool {
16 list($exists, $response) = $this->redis
23 function store(string $key, \http\Client\Response
$response): bool {
24 return $this->redis
->set($key, $response);
26 function del(string $key) : void
{
27 $this->redis
->del($key);
33 $api = include "examples.inc";
35 $api(function($api) use($cache) {
36 yield
$api->users
->m6w6();
37 yield
$api->users
->m6w6();