@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | /** |
69 | 69 | * @param \Psr\Cache\CacheItemInterface $item |
70 | - * @return mixed |
|
70 | + * @return boolean |
|
71 | 71 | * @throws \InvalidArgumentException |
72 | 72 | */ |
73 | 73 | public function driverWrite(CacheItemInterface $item) |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | - * @return bool |
|
145 | + * @return boolean|null |
|
146 | 146 | * @throws MongoConnectionException |
147 | 147 | * @throws LogicException |
148 | 148 | */ |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | /** |
183 | 183 | * @param \Psr\Cache\CacheItemInterface $item |
184 | - * @return bool |
|
184 | + * @return boolean|null |
|
185 | 185 | * @throws \InvalidArgumentException |
186 | 186 | */ |
187 | 187 | public function driverIsHit(CacheItemInterface $item) |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | if ($item instanceof Item) { |
79 | 79 | try { |
80 | 80 | $result = (array) $this->getCollection()->update( |
81 | - ['_id' => $item->getKey()], |
|
82 | - [ |
|
81 | + ['_id' => $item->getKey()], |
|
82 | + [ |
|
83 | 83 | '$set' => [ |
84 | - self::DRIVER_TIME_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : null), |
|
85 | - self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY), |
|
84 | + self::DRIVER_TIME_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : null), |
|
85 | + self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY), |
|
86 | 86 | ], |
87 | - ], |
|
88 | - ['upsert' => true, 'multiple' => false] |
|
87 | + ], |
|
88 | + ['upsert' => true, 'multiple' => false] |
|
89 | 89 | ); |
90 | 90 | } catch (MongoCursorException $e) { |
91 | 91 | return false; |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | $document = $this->getCollection()->findOne(['_id' => $key], [self::DRIVER_DATA_WRAPPER_INDEX, self::DRIVER_TIME_WRAPPER_INDEX /*'d', 'e'*/]); |
107 | 107 | if ($document) { |
108 | 108 | return [ |
109 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
110 | - self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec), |
|
109 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
110 | + self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec), |
|
111 | 111 | ]; |
112 | 112 | } else { |
113 | 113 | return null; |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | * @todo make an url builder |
163 | 163 | */ |
164 | 164 | $this->instance = $this->instance ?: (new MongodbClient('mongodb://' . |
165 | - ($username ?: '') . |
|
166 | - ($password ? ":{$password}" : '') . |
|
167 | - ($username ? '@' : '') . "{$host}" . |
|
168 | - ($port != '27017' ? ":{$port}" : ''), ['timeout' => $timeout * 1000]))->phpFastCache; |
|
165 | + ($username ?: '') . |
|
166 | + ($password ? ":{$password}" : '') . |
|
167 | + ($username ? '@' : '') . "{$host}" . |
|
168 | + ($port != '27017' ? ":{$port}" : ''), ['timeout' => $timeout * 1000]))->phpFastCache; |
|
169 | 169 | $this->instance->Cache->createIndex([self::DRIVER_TIME_WRAPPER_INDEX => 1], ['expireAfterSeconds' => 0]); |
170 | 170 | } |
171 | 171 | } |
@@ -206,23 +206,23 @@ discard block |
||
206 | 206 | public function getStats() |
207 | 207 | { |
208 | 208 | $serverStatus = $this->getCollection()->db->command([ |
209 | - 'serverStatus' => 1, |
|
210 | - 'recordStats' => 0, |
|
211 | - 'repl' => 0, |
|
212 | - 'metrics' => 0, |
|
209 | + 'serverStatus' => 1, |
|
210 | + 'recordStats' => 0, |
|
211 | + 'repl' => 0, |
|
212 | + 'metrics' => 0, |
|
213 | 213 | ]); |
214 | 214 | $collStats = $this->getCollection()->db->command([ |
215 | - 'collStats' => 'Cache', |
|
216 | - 'verbose' => true, |
|
215 | + 'collStats' => 'Cache', |
|
216 | + 'verbose' => true, |
|
217 | 217 | ]); |
218 | 218 | |
219 | 219 | $stats = (new driverStatistic()) |
220 | - ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1)) |
|
221 | - ->setSize((int) $collStats[ 'size' ]) |
|
222 | - ->setRawData([ |
|
220 | + ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1)) |
|
221 | + ->setSize((int) $collStats[ 'size' ]) |
|
222 | + ->setRawData([ |
|
223 | 223 | 'serverStatus' => $serverStatus, |
224 | 224 | 'collStats' => $collStats, |
225 | - ]); |
|
225 | + ]); |
|
226 | 226 | |
227 | 227 | return $stats; |
228 | 228 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | |
94 | - return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true; |
|
94 | + return isset($result['ok']) ? $result['ok'] == 1 : true; |
|
95 | 95 | } else { |
96 | 96 | throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
97 | 97 | } |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | $document = $this->getCollection()->findOne(['_id' => $key], [self::DRIVER_DATA_WRAPPER_INDEX, self::DRIVER_TIME_WRAPPER_INDEX /*'d', 'e'*/]); |
107 | 107 | if ($document) { |
108 | 108 | return [ |
109 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
110 | - self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec), |
|
109 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->bin), |
|
110 | + self::DRIVER_TIME_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_TIME_WRAPPER_INDEX]->sec), |
|
111 | 111 | ]; |
112 | 112 | } else { |
113 | 113 | return null; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | if ($item instanceof Item) { |
128 | 128 | $deletionResult = (array) $this->getCollection()->remove(['_id' => $item->getKey()], ["w" => 1]); |
129 | 129 | |
130 | - return (int) $deletionResult[ 'ok' ] === 1 && !$deletionResult[ 'err' ]; |
|
130 | + return (int) $deletionResult['ok'] === 1 && !$deletionResult['err']; |
|
131 | 131 | } else { |
132 | 132 | throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
133 | 133 | } |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | if ($this->instance instanceof MongodbClient) { |
152 | 152 | throw new LogicException('Already connected to Mongodb server'); |
153 | 153 | } else { |
154 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
155 | - $port = isset($server[ 'port' ]) ? $server[ 'port' ] : '27017'; |
|
156 | - $timeout = isset($server[ 'timeout' ]) ? $server[ 'timeout' ] : 3; |
|
157 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
158 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
154 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
155 | + $port = isset($server['port']) ? $server['port'] : '27017'; |
|
156 | + $timeout = isset($server['timeout']) ? $server['timeout'] : 3; |
|
157 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
158 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
159 | 159 | |
160 | 160 | |
161 | 161 | /** |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | { |
189 | 189 | $document = $this->getCollection()->findOne(['_id' => $item->getKey()], [self::DRIVER_TIME_WRAPPER_INDEX /*'d', 'e'*/]); |
190 | 190 | if ($document) { |
191 | - return $document[ self::DRIVER_TIME_WRAPPER_INDEX ]->sec >= time(); |
|
191 | + return $document[self::DRIVER_TIME_WRAPPER_INDEX]->sec >= time(); |
|
192 | 192 | } else { |
193 | 193 | return null; |
194 | 194 | } |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | ]); |
218 | 218 | |
219 | 219 | $stats = (new driverStatistic()) |
220 | - ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1)) |
|
221 | - ->setSize((int) $collStats[ 'size' ]) |
|
220 | + ->setInfo('MongoDB version ' . $serverStatus['version'] . ', Uptime (in days): ' . round($serverStatus['uptime'] / 86400, 1)) |
|
221 | + ->setSize((int) $collStats['size']) |
|
222 | 222 | ->setRawData([ |
223 | 223 | 'serverStatus' => $serverStatus, |
224 | 224 | 'collStats' => $collStats, |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
214 | - * @param $keyword |
|
214 | + * @param string $keyword |
|
215 | 215 | * @param bool $reset |
216 | 216 | * @return PDO |
217 | 217 | */ |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | /** |
250 | 250 | * @param \Psr\Cache\CacheItemInterface $item |
251 | - * @return mixed |
|
251 | + * @return boolean |
|
252 | 252 | * @throws \InvalidArgumentException |
253 | 253 | */ |
254 | 254 | public function driverWrite(CacheItemInterface $item) |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | } |
400 | 400 | |
401 | 401 | /** |
402 | - * @return bool |
|
402 | + * @return boolean|null |
|
403 | 403 | */ |
404 | 404 | public function driverConnect() |
405 | 405 | { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | $PDO = new PDO("sqlite:" . $this->SqliteDir . '/' . self::INDEXING_FILE); |
157 | 157 | $PDO->setAttribute(PDO::ATTR_ERRMODE, |
158 | - PDO::ERRMODE_EXCEPTION); |
|
158 | + PDO::ERRMODE_EXCEPTION); |
|
159 | 159 | |
160 | 160 | if ($createTable == true) { |
161 | 161 | $this->initIndexing($PDO); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | // look for keyword |
191 | 191 | $stm = $this->indexing->prepare("SELECT * FROM `balancing` WHERE `keyword`=:keyword LIMIT 1"); |
192 | 192 | $stm->execute([ |
193 | - ':keyword' => $keyword, |
|
193 | + ':keyword' => $keyword, |
|
194 | 194 | ]); |
195 | 195 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
196 | 196 | if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | $db = $this->currentDB; |
203 | 203 | $stm = $this->indexing->prepare("INSERT INTO `balancing` (`keyword`,`db`) VALUES(:keyword, :db)"); |
204 | 204 | $stm->execute([ |
205 | - ':keyword' => $keyword, |
|
206 | - ':db' => $db, |
|
205 | + ':keyword' => $keyword, |
|
206 | + ':db' => $db, |
|
207 | 207 | ]); |
208 | 208 | } |
209 | 209 | |
@@ -274,11 +274,11 @@ discard block |
||
274 | 274 | if ($toWrite == true) { |
275 | 275 | try { |
276 | 276 | $stm = $this->getDb($item->getKey()) |
277 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
277 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
278 | 278 | $stm->execute([ |
279 | - ':keyword' => $item->getKey(), |
|
280 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
281 | - ':exp' => time() + $item->getTtl(), |
|
279 | + ':keyword' => $item->getKey(), |
|
280 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
281 | + ':exp' => time() + $item->getTtl(), |
|
282 | 282 | ]); |
283 | 283 | |
284 | 284 | return true; |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | |
287 | 287 | try { |
288 | 288 | $stm = $this->getDb($item->getKey(), true) |
289 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
289 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
290 | 290 | $stm->execute([ |
291 | - ':keyword' => $item->getKey(), |
|
292 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
293 | - ':exp' => time() + $item->getTtl(), |
|
291 | + ':keyword' => $item->getKey(), |
|
292 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
293 | + ':exp' => time() + $item->getTtl(), |
|
294 | 294 | ]); |
295 | 295 | } catch (PDOException $e) { |
296 | 296 | return false; |
@@ -312,20 +312,20 @@ discard block |
||
312 | 312 | { |
313 | 313 | try { |
314 | 314 | $stm = $this->getDb($key) |
315 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
315 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
316 | 316 | $stm->execute([ |
317 | - ':keyword' => $key, |
|
318 | - ':U' => time(), |
|
317 | + ':keyword' => $key, |
|
318 | + ':U' => time(), |
|
319 | 319 | ]); |
320 | 320 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
321 | 321 | |
322 | 322 | } catch (PDOException $e) { |
323 | 323 | try { |
324 | 324 | $stm = $this->getDb($key, true) |
325 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
325 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
326 | 326 | $stm->execute([ |
327 | - ':keyword' => $key, |
|
328 | - ':U' => time(), |
|
327 | + ':keyword' => $key, |
|
328 | + ':U' => time(), |
|
329 | 329 | ]); |
330 | 330 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
331 | 331 | } catch (PDOException $e) { |
@@ -363,13 +363,13 @@ discard block |
||
363 | 363 | if ($item instanceof Item) { |
364 | 364 | try { |
365 | 365 | $stm = $this->getDb($item->getKey()) |
366 | - //->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) "); |
|
367 | - ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
366 | + //->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) "); |
|
367 | + ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
368 | 368 | |
369 | 369 | return $stm->execute([ |
370 | 370 | // ':id' => $row[ 'id' ], |
371 | - ':keyword' => $item->getKey(), |
|
372 | - ':U' => time(), |
|
371 | + ':keyword' => $item->getKey(), |
|
372 | + ':U' => time(), |
|
373 | 373 | ]); |
374 | 374 | } catch (PDOException $e) { |
375 | 375 | return false; |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | { |
406 | 406 | if (!file_exists($this->getPath() . '/' . self::SQLITE_DIR)) { |
407 | 407 | if (!mkdir($this->getPath() . '/' . self::SQLITE_DIR, |
408 | - $this->setChmodAuto()) |
|
408 | + $this->setChmodAuto()) |
|
409 | 409 | ) { |
410 | 410 | $this->fallback = true; |
411 | 411 | } |
@@ -428,10 +428,10 @@ discard block |
||
428 | 428 | * @todo: Check expiration time here |
429 | 429 | */ |
430 | 430 | $stm = $this->getDb($item->getKey()) |
431 | - ->prepare("SELECT COUNT(`id`) as `total` FROM `caching` WHERE (`keyword`=:keyword) AND (`exp` <= :U) "); |
|
431 | + ->prepare("SELECT COUNT(`id`) as `total` FROM `caching` WHERE (`keyword`=:keyword) AND (`exp` <= :U) "); |
|
432 | 432 | $stm->execute([ |
433 | - ':keyword' => $item->getKey(), |
|
434 | - ':U' => time(), |
|
433 | + ':keyword' => $item->getKey(), |
|
434 | + ':U' => time(), |
|
435 | 435 | ]); |
436 | 436 | $data = $stm->fetch(PDO::FETCH_ASSOC); |
437 | 437 | if ($data[ 'total' ] >= 1) { |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | $stat = new driverStatistic(); |
460 | 460 | |
461 | 461 | $res = [ |
462 | - 'info' => '', |
|
463 | - 'size' => '', |
|
464 | - 'data' => '', |
|
462 | + 'info' => '', |
|
463 | + 'size' => '', |
|
464 | + 'data' => '', |
|
465 | 465 | ]; |
466 | 466 | $total = 0; |
467 | 467 | $optimized = 0; |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | try { |
477 | 477 | $PDO = new PDO("sqlite:" . $file_path); |
478 | 478 | $PDO->setAttribute(PDO::ATTR_ERRMODE, |
479 | - PDO::ERRMODE_EXCEPTION); |
|
479 | + PDO::ERRMODE_EXCEPTION); |
|
480 | 480 | |
481 | 481 | $stm = $PDO->prepare("DELETE FROM `caching` WHERE `exp` <= :U"); |
482 | 482 | $stm->execute([ |
483 | - ':U' => date('U'), |
|
483 | + ':U' => date('U'), |
|
484 | 484 | ]); |
485 | 485 | |
486 | 486 | $PDO->exec('VACUUM;'); |
@@ -494,9 +494,9 @@ discard block |
||
494 | 494 | } |
495 | 495 | |
496 | 496 | $stat->setSize($optimized) |
497 | - ->setInfo('Total before removing expired entries [bytes]: ' . $total . ', ' |
|
497 | + ->setInfo('Total before removing expired entries [bytes]: ' . $total . ', ' |
|
498 | 498 | . 'Optimized after removing expired entries [bytes]: ' . $optimized |
499 | - ); |
|
499 | + ); |
|
500 | 500 | |
501 | 501 | return $stat; |
502 | 502 | } |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | $stm = $this->indexing->prepare("SELECT MAX(`db`) as `db` FROM `balancing`"); |
167 | 167 | $stm->execute(); |
168 | 168 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
169 | - if (!isset($row[ 'db' ])) { |
|
169 | + if (!isset($row['db'])) { |
|
170 | 170 | $db = 1; |
171 | - } elseif ($row[ 'db' ] <= 1) { |
|
171 | + } elseif ($row['db'] <= 1) { |
|
172 | 172 | $db = 1; |
173 | 173 | } else { |
174 | - $db = $row[ 'db' ]; |
|
174 | + $db = $row['db']; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | // check file size |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | ':keyword' => $keyword, |
194 | 194 | ]); |
195 | 195 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
196 | - if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
|
197 | - $db = $row[ 'db' ]; |
|
196 | + if (isset($row['db']) && $row['db'] != '') { |
|
197 | + $db = $row['db']; |
|
198 | 198 | } else { |
199 | 199 | /* |
200 | 200 | * Insert new to Indexing |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | /** |
226 | 226 | * init instant |
227 | 227 | */ |
228 | - if (!isset($this->instance[ $instant ])) { |
|
228 | + if (!isset($this->instance[$instant])) { |
|
229 | 229 | // check DB Files ready or not |
230 | 230 | $createTable = false; |
231 | 231 | if (!file_exists($this->SqliteDir . '/db' . $instant) || $reset == true) { |
@@ -238,12 +238,12 @@ discard block |
||
238 | 238 | $this->initDB($PDO); |
239 | 239 | } |
240 | 240 | |
241 | - $this->instance[ $instant ] = $PDO; |
|
241 | + $this->instance[$instant] = $PDO; |
|
242 | 242 | unset($PDO); |
243 | 243 | |
244 | 244 | } |
245 | 245 | |
246 | - return $this->instance[ $instant ]; |
|
246 | + return $this->instance[$instant]; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * Check for Cross-Driver type confusion |
258 | 258 | */ |
259 | 259 | if ($item instanceof Item) { |
260 | - $skipExisting = isset($this->config[ 'skipExisting' ]) ? $this->config[ 'skipExisting' ] : false; |
|
260 | + $skipExisting = isset($this->config['skipExisting']) ? $this->config['skipExisting'] : false; |
|
261 | 261 | $toWrite = true; |
262 | 262 | |
263 | 263 | // check in cache first |
@@ -333,18 +333,18 @@ discard block |
||
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | - if (isset($row[ 'id' ])) { |
|
336 | + if (isset($row['id'])) { |
|
337 | 337 | /** |
338 | 338 | * @var $item ExtendedCacheItemInterface |
339 | 339 | */ |
340 | - $item = $this->decode($row[ 'object' ]); |
|
340 | + $item = $this->decode($row['object']); |
|
341 | 341 | if ($item instanceof ExtendedCacheItemInterface && $item->isExpired()) { |
342 | 342 | $this->driverDelete($item); |
343 | 343 | |
344 | 344 | return null; |
345 | 345 | } |
346 | 346 | |
347 | - return $this->decode($row[ 'object' ]); |
|
347 | + return $this->decode($row['object']); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | return null; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | ':U' => time(), |
435 | 435 | ]); |
436 | 436 | $data = $stm->fetch(PDO::FETCH_ASSOC); |
437 | - if ($data[ 'total' ] >= 1) { |
|
437 | + if ($data['total'] >= 1) { |
|
438 | 438 | return true; |
439 | 439 | } else { |
440 | 440 | return false; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | // Setup File Path on your config files |
18 | 18 | CacheManager::setup([ |
19 | - "path" => '/var/www/phpfastcache.dev.geolim4.com/geolim4/tmp', // or in windows "C:/tmp/" |
|
19 | + "path" => '/var/www/phpfastcache.dev.geolim4.com/geolim4/tmp', // or in windows "C:/tmp/" |
|
20 | 20 | ]); |
21 | 21 | |
22 | 22 | // In your class, function, you can call the Cache |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function __construct(array $config = []) |
13 | 13 | { |
14 | - $config[ 'path' ] = 'your/custom/path/where/files/will/be/written'; |
|
14 | + $config['path'] = 'your/custom/path/where/files/will/be/written'; |
|
15 | 15 | parent::__construct($config); |
16 | 16 | /** |
17 | 17 | * That's all !! Your cache class is ready to use |
@@ -11,11 +11,11 @@ |
||
11 | 11 | require __DIR__ . '/../vendor/autoload.php'; |
12 | 12 | |
13 | 13 | $InstanceCache = CacheManager::getInstance('mongodb', [ |
14 | - 'host' => '127.0.0.1', |
|
15 | - 'port' => '27017', |
|
16 | - 'username' => '', |
|
17 | - 'password' => '', |
|
18 | - 'timeout' => '1', |
|
14 | + 'host' => '127.0.0.1', |
|
15 | + 'port' => '27017', |
|
16 | + 'username' => '', |
|
17 | + 'password' => '', |
|
18 | + 'timeout' => '1', |
|
19 | 19 | ]); |
20 | 20 | |
21 | 21 |
@@ -11,17 +11,17 @@ |
||
11 | 11 | require __DIR__ . '/../vendor/autoload.php'; |
12 | 12 | |
13 | 13 | $InstanceCache = CacheManager::getInstance('couchbase', [ |
14 | - 'host' => 'your-couchbase-host', |
|
15 | - 'port' => '11211', |
|
16 | - 'username' => 'your-couchbase-username', |
|
17 | - 'password' => 'your-couchbase-password', |
|
18 | - 'timeout' => '1', |
|
19 | - 'buckets' => [ |
|
14 | + 'host' => 'your-couchbase-host', |
|
15 | + 'port' => '11211', |
|
16 | + 'username' => 'your-couchbase-username', |
|
17 | + 'password' => 'your-couchbase-password', |
|
18 | + 'timeout' => '1', |
|
19 | + 'buckets' => [ |
|
20 | 20 | [ |
21 | - 'default' => 'Cache',// The bucket name, generally "default" by default |
|
22 | - 'password' => ''// The bucket password if there is |
|
21 | + 'default' => 'Cache',// The bucket name, generally "default" by default |
|
22 | + 'password' => ''// The bucket password if there is |
|
23 | + ], |
|
23 | 24 | ], |
24 | - ], |
|
25 | 25 | ]); |
26 | 26 | |
27 | 27 | /** |
@@ -18,7 +18,7 @@ |
||
18 | 18 | 'timeout' => '1', |
19 | 19 | 'buckets' => [ |
20 | 20 | [ |
21 | - 'default' => 'Cache',// The bucket name, generally "default" by default |
|
21 | + 'default' => 'Cache', // The bucket name, generally "default" by default |
|
22 | 22 | 'password' => ''// The bucket password if there is |
23 | 23 | ], |
24 | 24 | ], |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | // Setup File Path on your config files |
18 | 18 | CacheManager::setup([ |
19 | - "path" => '/var/www/phpfastcache.dev.geolim4.com/geolim4/tmp', // or in windows "C:/tmp/" |
|
19 | + "path" => '/var/www/phpfastcache.dev.geolim4.com/geolim4/tmp', // or in windows "C:/tmp/" |
|
20 | 20 | ]); |
21 | 21 | |
22 | 22 | // In your class, function, you can call the Cache |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | // Setup File Path on your config files |
18 | 18 | CacheManager::setup([ |
19 | - "path" => '/var/www/phpfastcache.dev.geolim4.com/geolim4/tmp', // or in windows "C:/tmp/" |
|
19 | + "path" => '/var/www/phpfastcache.dev.geolim4.com/geolim4/tmp', // or in windows "C:/tmp/" |
|
20 | 20 | ]); |
21 | 21 | |
22 | 22 | // In your class, function, you can call the Cache |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | // Setup File Path on your config files |
18 | 18 | CacheManager::setup([ |
19 | - "path" => '/var/www/phpfastcache.dev.geolim4.com/geolim4/tmp', // or in windows "C:/tmp/" |
|
19 | + "path" => '/var/www/phpfastcache.dev.geolim4.com/geolim4/tmp', // or in windows "C:/tmp/" |
|
20 | 20 | ]); |
21 | 21 | |
22 | 22 | // In your class, function, you can call the Cache |