1 | <?php |
||
10 | final class PsrCacheAdapter extends BaseAdapter |
||
11 | { |
||
12 | /** |
||
13 | * @var CacheItemPoolInterface |
||
14 | */ |
||
15 | private $cacheItemPool; |
||
16 | |||
17 | /** |
||
18 | * @param CacheItemPoolInterface $cacheItemPool |
||
19 | * @param int $ttl |
||
20 | * @param string $cachePrefix |
||
21 | */ |
||
22 | 5 | public function __construct(CacheItemPoolInterface $cacheItemPool, int $ttl = 3600, string $cachePrefix = null) |
|
27 | |||
28 | /** |
||
29 | * Helper method to make sure that extension is loaded (implementation dependent) |
||
30 | * |
||
31 | * @throws \Paymaxi\Component\CircuitBreaker\Storage\StorageException if extension is not loaded |
||
32 | * @return void |
||
33 | */ |
||
34 | protected function checkExtension() |
||
37 | |||
38 | /** |
||
39 | * Loads item by cache key. |
||
40 | * |
||
41 | * @param string $key |
||
42 | * |
||
43 | * @return mixed |
||
44 | * |
||
45 | * @throws \Paymaxi\Component\CircuitBreaker\Storage\StorageException if storage error occurs, handler can not be used |
||
46 | */ |
||
47 | 5 | protected function load($key) |
|
56 | |||
57 | /** |
||
58 | * Save item in the cache. |
||
59 | * |
||
60 | * @param string $key |
||
61 | * @param string $value |
||
62 | * @param int $ttl |
||
63 | * |
||
64 | * @return void |
||
65 | * |
||
66 | * @throws \Paymaxi\Component\CircuitBreaker\Storage\StorageException if storage error occurs, handler can not be used |
||
67 | */ |
||
68 | 5 | protected function save($key, $value, $ttl) |
|
74 | } |