1 | <?php |
||
15 | class StampedeCallbackAdapter implements CallbackCacheInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var CacheAdapterInterface |
||
19 | */ |
||
20 | private $cache; |
||
21 | |||
22 | /** |
||
23 | * @var int |
||
24 | */ |
||
25 | private $pregenerateIn; |
||
26 | |||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | private $useInvalidDataOnException = false; |
||
31 | |||
32 | /** |
||
33 | * @param CacheAdapterInterface $cache |
||
34 | * @param $pregenerateInSeconds |
||
35 | * @param bool $useInvalidDataOnException |
||
36 | */ |
||
37 | 5 | public function __construct( |
|
46 | |||
47 | /** |
||
48 | * @deprecated |
||
49 | */ |
||
50 | 1 | public function useInvalidDataOnException() |
|
54 | |||
55 | /** |
||
56 | * @param $key |
||
57 | * @param callable $cb |
||
58 | * @return mixed|null |
||
59 | * @throws Exception |
||
60 | */ |
||
61 | 5 | public function get($key, callable $cb) |
|
74 | |||
75 | /** |
||
76 | * @param $key |
||
77 | * @return bool |
||
78 | */ |
||
79 | 3 | private function needsPregeneration($key) |
|
93 | |||
94 | /** |
||
95 | * @param $key |
||
96 | * @param callable $cb |
||
97 | * @param $currentItem |
||
98 | * @return mixed |
||
99 | * @throws Exception |
||
100 | */ |
||
101 | 5 | private function pregenerate($key, callable $cb, $currentItem) |
|
116 | |||
117 | /** |
||
118 | * @param $key |
||
119 | */ |
||
120 | 5 | private function lock($key) |
|
124 | |||
125 | /** |
||
126 | * @param $key |
||
127 | * @param integer $pregenerateIn |
||
128 | */ |
||
129 | 5 | private function unlock($key, $pregenerateIn = null) |
|
139 | } |
||
140 |