1 | <?php |
||
15 | class FixedInMemoryLruCache implements Cache { |
||
16 | |||
17 | /** |
||
18 | * @var array |
||
19 | */ |
||
20 | private $cache = array(); |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | private $ttl = array(); |
||
26 | |||
27 | /** |
||
28 | * @var integer |
||
29 | */ |
||
30 | private $maxCacheCount; |
||
31 | |||
32 | /** |
||
33 | * @var integer |
||
34 | */ |
||
35 | private $count = 0; |
||
36 | |||
37 | /** |
||
38 | * @var integer |
||
39 | */ |
||
40 | private $cacheInserts = 0; |
||
41 | |||
42 | /** |
||
43 | * @var integer |
||
44 | */ |
||
45 | private $cacheDeletes = 0; |
||
46 | |||
47 | /** |
||
48 | * @var integer |
||
49 | */ |
||
50 | private $cacheHits = 0; |
||
51 | |||
52 | /** |
||
53 | * @var integer |
||
54 | */ |
||
55 | private $cacheMisses = 0; |
||
56 | |||
57 | /** |
||
58 | * @since 1.0 |
||
59 | * |
||
60 | * @param integer $maxCacheCount |
||
61 | */ |
||
62 | 12 | public function __construct( $maxCacheCount = 500 ) { |
|
65 | |||
66 | /** |
||
67 | * @since 1.0 |
||
68 | * |
||
69 | * {@inheritDoc} |
||
70 | */ |
||
71 | 10 | public function contains( $id ) { |
|
85 | |||
86 | /** |
||
87 | * @since 1.0 |
||
88 | * |
||
89 | * {@inheritDoc} |
||
90 | */ |
||
91 | 9 | public function fetch( $id ) { |
|
101 | |||
102 | /** |
||
103 | * @since 1.0 |
||
104 | * |
||
105 | * {@inheritDoc} |
||
106 | */ |
||
107 | 10 | public function save( $id, $value, $ttl = 0 ) { |
|
124 | |||
125 | /** |
||
126 | * @since 1.0 |
||
127 | * |
||
128 | * {@inheritDoc} |
||
129 | */ |
||
130 | 2 | public function delete( $id ) { |
|
142 | |||
143 | /** |
||
144 | * @since 1.0 |
||
145 | * |
||
146 | * {@inheritDoc} |
||
147 | */ |
||
148 | 2 | public function getStats() { |
|
158 | |||
159 | /** |
||
160 | * @since 1.2 |
||
161 | * |
||
162 | * {@inheritDoc} |
||
163 | */ |
||
164 | 1 | public function getName() { |
|
167 | |||
168 | 9 | private function moveToMostRecentlyUsedPosition( $id ) { |
|
176 | |||
177 | } |
||
178 |