1 | <?php |
||
33 | class ThrottlerCache implements ThrottlerCacheInterface |
||
34 | { |
||
35 | /** |
||
36 | * @var CacheItemPoolInterface |
||
37 | */ |
||
38 | private $cacheItemPool; |
||
39 | |||
40 | /** |
||
41 | * ThrottlerCache constructor. |
||
42 | * |
||
43 | * @param CacheItemPoolInterface $cacheItemPool |
||
44 | */ |
||
45 | public function __construct(CacheItemPoolInterface $cacheItemPool) |
||
49 | |||
50 | /** |
||
51 | * @param string $key |
||
52 | * |
||
53 | * @return ThrottlerItemInterface |
||
54 | */ |
||
55 | public function getItem(string $key): ThrottlerItemInterface |
||
61 | |||
62 | /** |
||
63 | * @param string $key |
||
64 | * |
||
65 | * @return bool |
||
66 | */ |
||
67 | public function hasItem(string $key): bool |
||
71 | |||
72 | /** |
||
73 | * @param string $key |
||
74 | * @param mixed $item |
||
75 | * @return bool |
||
76 | */ |
||
77 | public function setItem(string $key, ThrottlerItemInterface $item): bool |
||
81 | |||
82 | /** |
||
83 | * @param string $key |
||
84 | */ |
||
85 | public function removeItem(string $key) |
||
89 | |||
90 | /** |
||
91 | * @param string $key |
||
92 | * |
||
93 | * @return ThrottlerItemInterface |
||
94 | * @throws CacheAdapterException |
||
95 | * @throws ItemNotFoundException |
||
96 | */ |
||
97 | private function getThrottlerItem(string $key): ThrottlerItemInterface |
||
113 | |||
114 | /** |
||
115 | * @param string $key |
||
116 | * @param ThrottlerItemInterface $item |
||
117 | * |
||
118 | * @return bool |
||
119 | * @throws CacheAdapterException |
||
120 | */ |
||
121 | private function setThrottlerItem(string $key, ThrottlerItemInterface $item) |
||
146 | } |