1 | <?php |
||
28 | class CouchbaseStore extends TaggableStore implements Store |
||
29 | { |
||
30 | use RetrievesMultipleKeys; |
||
31 | |||
32 | /** @var string */ |
||
33 | protected $prefix; |
||
34 | |||
35 | /** @var CouchbaseBucket */ |
||
36 | protected $bucket; |
||
37 | |||
38 | /** @var CouchbaseCluster */ |
||
39 | protected $cluster; |
||
40 | |||
41 | /** |
||
42 | * CouchbaseStore constructor. |
||
43 | * |
||
44 | * @param CouchbaseCluster $cluster |
||
45 | * @param $bucket |
||
46 | * @param string $password |
||
47 | * @param null $prefix |
||
48 | * @param string $serialize |
||
49 | */ |
||
50 | 15 | public function __construct(CouchbaseCluster $cluster, $bucket, $password = '', $prefix = null, $serialize = 'php') |
|
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | 8 | public function get($key) |
|
70 | |||
71 | /** |
||
72 | * Store an item in the cache if the key doesn't exist. |
||
73 | * |
||
74 | * @param string|array $key |
||
75 | * @param mixed $value |
||
76 | * @param int $minutes |
||
77 | * |
||
78 | * @return bool |
||
79 | */ |
||
80 | 7 | public function add($key, $value, $minutes = 0) |
|
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | 1 | public function put($key, $value, $minutes) |
|
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | 1 | public function increment($key, $value = 1) |
|
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | */ |
||
112 | 1 | public function decrement($key, $value = 1) |
|
117 | |||
118 | /** |
||
119 | * {@inheritdoc} |
||
120 | */ |
||
121 | 1 | public function forever($key, $value) |
|
130 | |||
131 | /** |
||
132 | * {@inheritdoc} |
||
133 | */ |
||
134 | 8 | public function forget($key) |
|
142 | |||
143 | /** |
||
144 | * flush bucket. |
||
145 | * |
||
146 | * @throws FlushException |
||
147 | * @codeCoverageIgnore |
||
148 | */ |
||
149 | public function flush() |
||
156 | |||
157 | /** |
||
158 | * {@inheritdoc} |
||
159 | */ |
||
160 | 1 | public function getPrefix() |
|
164 | |||
165 | /** |
||
166 | * Set the cache key prefix. |
||
167 | * |
||
168 | * @param string $prefix |
||
169 | */ |
||
170 | 15 | public function setPrefix($prefix) |
|
174 | |||
175 | /** |
||
176 | * @param $bucket |
||
177 | * @param string $password |
||
178 | * @param string $serialize |
||
179 | * |
||
180 | * @return $this |
||
181 | */ |
||
182 | 15 | public function setBucket($bucket, $password = '', $serialize = 'php') |
|
191 | |||
192 | /** |
||
193 | * @param $keys |
||
194 | * |
||
195 | * @return array|string |
||
196 | */ |
||
197 | 11 | private function resolveKey($keys) |
|
210 | |||
211 | /** |
||
212 | * @param $meta |
||
213 | * |
||
214 | * @return array|null |
||
215 | */ |
||
216 | 6 | protected function getMetaDoc($meta) |
|
232 | } |
||
233 |