1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Gember\CachePsr\Test\TestDoubles; |
||
6 | |||
7 | use Psr\SimpleCache\CacheInterface; |
||
8 | use DateInterval; |
||
9 | |||
10 | final class TestPsrSimpleCache implements CacheInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var array<string, array{mixed, int|DateInterval|null}> |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
14 | */ |
||
15 | public array $data = []; |
||
16 | |||
17 | public function get(string $key, mixed $default = null): mixed |
||
18 | { |
||
19 | return $this->data[$key][0] ?? null; |
||
20 | } |
||
21 | |||
22 | public function set(string $key, mixed $value, DateInterval|int|null $ttl = null): bool |
||
23 | { |
||
24 | $this->data[$key] = [$value, $ttl]; |
||
25 | |||
26 | return true; |
||
27 | } |
||
28 | |||
29 | public function delete(string $key): bool |
||
30 | { |
||
31 | // n/a |
||
32 | return true; |
||
33 | } |
||
34 | |||
35 | public function clear(): bool |
||
36 | { |
||
37 | // n/a |
||
38 | return true; |
||
39 | } |
||
40 | |||
41 | public function getMultiple(iterable $keys, mixed $default = null): iterable |
||
42 | { |
||
43 | // n/a |
||
44 | return []; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param iterable<mixed> $values |
||
49 | */ |
||
50 | public function setMultiple(iterable $values, DateInterval|int|null $ttl = null): bool |
||
51 | { |
||
52 | // n/a |
||
53 | return true; |
||
54 | } |
||
55 | |||
56 | public function deleteMultiple(iterable $keys): bool |
||
57 | { |
||
58 | // n/a |
||
59 | return true; |
||
60 | } |
||
61 | |||
62 | public function has(string $key): bool |
||
63 | { |
||
64 | return isset($this->data[$key]); |
||
65 | } |
||
66 | } |
||
67 |