1 | <?php |
||
17 | class ZendCache implements Cache { |
||
18 | |||
19 | /** |
||
20 | * @var StorageInterface |
||
21 | */ |
||
22 | private $cache = null; |
||
23 | |||
24 | /** |
||
25 | * @var integer |
||
26 | */ |
||
27 | private $cacheInserts = 0; |
||
28 | |||
29 | /** |
||
30 | * @var integer |
||
31 | */ |
||
32 | private $cacheDeletes = 0; |
||
33 | |||
34 | /** |
||
35 | * @var integer |
||
36 | */ |
||
37 | private $cacheHits = 0; |
||
38 | |||
39 | /** |
||
40 | * @var integer |
||
41 | */ |
||
42 | private $cacheMisses = 0; |
||
43 | |||
44 | /** |
||
45 | * @since 1.1 |
||
46 | * |
||
47 | * @param StorageInterface $cache |
||
48 | */ |
||
49 | 10 | public function __construct( StorageInterface $cache ) { |
|
52 | |||
53 | /** |
||
54 | * @since 1.1 |
||
55 | * |
||
56 | * {@inheritDoc} |
||
57 | */ |
||
58 | 3 | public function fetch( $id ) { |
|
68 | |||
69 | /** |
||
70 | * @since 1.1 |
||
71 | * |
||
72 | * {@inheritDoc} |
||
73 | */ |
||
74 | 4 | public function contains( $id ) { |
|
77 | |||
78 | /** |
||
79 | * @note ZF2 doesn't support per-item ttl storage therefore we use |
||
80 | * https://github.com/zendframework/zf2/pull/5386#issuecomment-43191005 |
||
81 | * |
||
82 | * - ttl with 0 means an item never expires |
||
83 | * |
||
84 | * @since 1.1 |
||
85 | * |
||
86 | * {@inheritDoc} |
||
87 | */ |
||
88 | 3 | public function save( $id, $data, $ttl = 0 ) { |
|
105 | |||
106 | /** |
||
107 | * @since 1.1 |
||
108 | * |
||
109 | * {@inheritDoc} |
||
110 | */ |
||
111 | 2 | public function delete( $id ) { |
|
115 | |||
116 | /** |
||
117 | * @since 1.1 |
||
118 | * |
||
119 | * {@inheritDoc} |
||
120 | */ |
||
121 | 4 | public function getStats() { |
|
129 | |||
130 | /** |
||
131 | * @since 1.2 |
||
132 | * |
||
133 | * {@inheritDoc} |
||
134 | */ |
||
135 | 1 | public function getName() { |
|
138 | |||
139 | } |
||
140 |