1 | <?php |
||
26 | class CouchbaseStore extends TaggableStore implements Store |
||
27 | { |
||
28 | use RetrievesMultipleKeys; |
||
29 | |||
30 | /** @var string */ |
||
31 | protected $prefix; |
||
32 | |||
33 | /** @var CouchbaseBucket */ |
||
34 | protected $bucket; |
||
35 | |||
36 | /** @var CouchbaseCluster */ |
||
37 | protected $cluster; |
||
38 | |||
39 | /** |
||
40 | * CouchbaseStore constructor. |
||
41 | * |
||
42 | * @param CouchbaseCluster $cluster |
||
43 | * @param $bucket |
||
44 | * @param string $password |
||
45 | * @param null $prefix |
||
46 | * @param string $serialize |
||
47 | */ |
||
48 | 14 | public function __construct(CouchbaseCluster $cluster, $bucket, $password = '', $prefix = null, $serialize = 'php') |
|
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | 8 | public function get($key) |
|
68 | |||
69 | /** |
||
70 | * Store an item in the cache if the key doesn't exist. |
||
71 | * |
||
72 | * @param string|array $key |
||
73 | * @param mixed $value |
||
74 | * @param int $minutes |
||
75 | * |
||
76 | * @return bool |
||
77 | */ |
||
78 | 7 | public function add($key, $value, $minutes = 0) |
|
89 | |||
90 | /** |
||
91 | * {@inheritdoc} |
||
92 | */ |
||
93 | 1 | public function put($key, $value, $minutes) |
|
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | 1 | public function increment($key, $value = 1) |
|
106 | |||
107 | /** |
||
108 | * {@inheritdoc} |
||
109 | */ |
||
110 | 1 | public function decrement($key, $value = 1) |
|
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | */ |
||
119 | 1 | public function forever($key, $value) |
|
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | 8 | public function forget($key) |
|
140 | |||
141 | /** |
||
142 | * flush bucket. |
||
143 | * |
||
144 | * @throws FlushException |
||
145 | * @codeCoverageIgnore |
||
146 | */ |
||
147 | public function flush() |
||
154 | |||
155 | /** |
||
156 | * {@inheritdoc} |
||
157 | */ |
||
158 | 1 | public function getPrefix() |
|
162 | |||
163 | /** |
||
164 | * Set the cache key prefix. |
||
165 | * |
||
166 | * @param string $prefix |
||
167 | */ |
||
168 | 14 | public function setPrefix($prefix) |
|
172 | |||
173 | /** |
||
174 | * @param $bucket |
||
175 | * @param string $password |
||
176 | * @param string $serialize |
||
177 | * |
||
178 | * @return $this |
||
179 | */ |
||
180 | 14 | public function setBucket($bucket, $password = '', $serialize = 'php') |
|
189 | |||
190 | /** |
||
191 | * @param $keys |
||
192 | * |
||
193 | * @return array|string |
||
194 | */ |
||
195 | 11 | private function resolveKey($keys) |
|
208 | |||
209 | /** |
||
210 | * @param $meta |
||
211 | * |
||
212 | * @return array|null |
||
213 | */ |
||
214 | 6 | protected function getMetaDoc($meta) |
|
230 | } |
||
231 |