@@ -63,7 +63,7 @@ |
||
63 | 63 | |
64 | 64 | |
65 | 65 | /** |
66 | - * @return bool |
|
66 | + * @return false|null |
|
67 | 67 | */ |
68 | 68 | public function connectServer() |
69 | 69 | { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $s = $this->config[ 'memcache' ]; |
75 | 75 | if (count($s) < 1) { |
76 | 76 | $s = array( |
77 | - array('127.0.0.1', 11211, 100), |
|
77 | + array('127.0.0.1', 11211, 100), |
|
78 | 78 | ); |
79 | 79 | } |
80 | 80 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | try { |
88 | 88 | if ($sharing > 0) { |
89 | 89 | if (!$this->instant->addServer($name, $port, |
90 | - $sharing) |
|
90 | + $sharing) |
|
91 | 91 | ) { |
92 | 92 | $this->fallback = true; |
93 | 93 | } |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | { |
169 | 169 | $this->connectServer(); |
170 | 170 | $res = array( |
171 | - 'info' => '', |
|
172 | - 'size' => '', |
|
173 | - 'data' => $this->instant->getStats(), |
|
171 | + 'info' => '', |
|
172 | + 'size' => '', |
|
173 | + 'data' => $this->instant->getStats(), |
|
174 | 174 | ); |
175 | 175 | |
176 | 176 | return $res; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | $this->setup($config); |
39 | 39 | |
40 | - if (!$this->checkdriver() && !isset($config[ 'skipError' ])) { |
|
40 | + if (!$this->checkdriver() && !isset($config['skipError'])) { |
|
41 | 41 | $this->fallback = true; |
42 | 42 | } |
43 | 43 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | return false; |
72 | 72 | } |
73 | 73 | |
74 | - $s = $this->config[ 'memcache' ]; |
|
74 | + $s = $this->config['memcache']; |
|
75 | 75 | if (count($s) < 1) { |
76 | 76 | $s = array( |
77 | 77 | array('127.0.0.1', 11211, 100), |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | foreach ($s as $server) { |
82 | - $name = isset($server[ 0 ]) ? $server[ 0 ] : '127.0.0.1'; |
|
83 | - $port = isset($server[ 1 ]) ? $server[ 1 ] : 11211; |
|
84 | - $sharing = isset($server[ 2 ]) ? $server[ 2 ] : 0; |
|
82 | + $name = isset($server[0]) ? $server[0] : '127.0.0.1'; |
|
83 | + $port = isset($server[1]) ? $server[1] : 11211; |
|
84 | + $sharing = isset($server[2]) ? $server[2] : 0; |
|
85 | 85 | $checked = $name . '_' . $port; |
86 | - if (!isset($this->checked[ $checked ])) { |
|
86 | + if (!isset($this->checked[$checked])) { |
|
87 | 87 | try { |
88 | 88 | if ($sharing > 0) { |
89 | 89 | if (!$this->instant->addServer($name, $port, |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->fallback = true; |
98 | 98 | } |
99 | 99 | } |
100 | - $this->checked[ $checked ] = 1; |
|
100 | + $this->checked[$checked] = 1; |
|
101 | 101 | } catch (\Exception $e) { |
102 | 102 | $this->fallback = true; |
103 | 103 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $time = time() + $time; |
124 | 124 | } |
125 | 125 | |
126 | - if (isset($option[ 'isExisting' ]) && $option[ 'isExisting' ] == true) { |
|
126 | + if (isset($option['isExisting']) && $option['isExisting'] == true) { |
|
127 | 127 | return $this->instant->add($keyword, $value, $time); |
128 | 128 | } else { |
129 | 129 | return $this->instant->set($keyword, $value, $time); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | // return null if no caching |
142 | 142 | // return value if in caching |
143 | 143 | $this->connectServer(); |
144 | - $x = @$this->instant->get($keyword);// Prevent memcached to return a warning for long keywords |
|
144 | + $x = @$this->instant->get($keyword); // Prevent memcached to return a warning for long keywords |
|
145 | 145 | if ($x == false) { |
146 | 146 | return null; |
147 | 147 | } else { |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | /** |
355 | 355 | * @param $row |
356 | - * @return bool |
|
356 | + * @return null|false |
|
357 | 357 | */ |
358 | 358 | public function deleteRow($row) |
359 | 359 | { |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | /** |
373 | 373 | * @param $keyword |
374 | 374 | * @param array $option |
375 | - * @return bool |
|
375 | + * @return null|false |
|
376 | 376 | */ |
377 | 377 | public function driver_delete($keyword, $option = array()) |
378 | 378 | { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | if (!file_exists($this->getPath() . '/' . self::SQLITE_DIR)) { |
77 | 77 | if (!mkdir($this->getPath() . '/' . self::SQLITE_DIR, |
78 | - $this->__setChmodAuto()) |
|
78 | + $this->__setChmodAuto()) |
|
79 | 79 | ) { |
80 | 80 | $this->fallback = true; |
81 | 81 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | $PDO = new PDO("sqlite:" . $this->path . '/' . self::INDEXING_FILE); |
136 | 136 | $PDO->setAttribute(PDO::ATTR_ERRMODE, |
137 | - PDO::ERRMODE_EXCEPTION); |
|
137 | + PDO::ERRMODE_EXCEPTION); |
|
138 | 138 | |
139 | 139 | if ($createTable == true) { |
140 | 140 | $this->initIndexing($PDO); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | // look for keyword |
170 | 170 | $stm = $this->indexing->prepare("SELECT * FROM `balancing` WHERE `keyword`=:keyword LIMIT 1"); |
171 | 171 | $stm->execute(array( |
172 | - ':keyword' => $keyword, |
|
172 | + ':keyword' => $keyword, |
|
173 | 173 | )); |
174 | 174 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
175 | 175 | if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | $db = $this->currentDB; |
182 | 182 | $stm = $this->indexing->prepare("INSERT INTO `balancing` (`keyword`,`db`) VALUES(:keyword, :db)"); |
183 | 183 | $stm->execute(array( |
184 | - ':keyword' => $keyword, |
|
185 | - ':db' => $db, |
|
184 | + ':keyword' => $keyword, |
|
185 | + ':db' => $db, |
|
186 | 186 | )); |
187 | 187 | } |
188 | 188 | |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | * @return bool |
247 | 247 | */ |
248 | 248 | public function driver_set( |
249 | - $keyword, |
|
250 | - $value = '', |
|
251 | - $time = 300, |
|
252 | - $option = array() |
|
249 | + $keyword, |
|
250 | + $value = '', |
|
251 | + $time = 300, |
|
252 | + $option = array() |
|
253 | 253 | ) { |
254 | 254 | $skipExisting = isset($option[ 'skipExisting' ]) ? $option[ 'skipExisting' ] : false; |
255 | 255 | $toWrite = true; |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | if ($toWrite == true) { |
269 | 269 | try { |
270 | 270 | $stm = $this->db($keyword) |
271 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
271 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
272 | 272 | $stm->execute(array( |
273 | - ':keyword' => $keyword, |
|
274 | - ':object' => $this->encode($value), |
|
275 | - ':exp' => time() + (int)$time, |
|
273 | + ':keyword' => $keyword, |
|
274 | + ':object' => $this->encode($value), |
|
275 | + ':exp' => time() + (int)$time, |
|
276 | 276 | )); |
277 | 277 | |
278 | 278 | return true; |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | |
281 | 281 | try { |
282 | 282 | $stm = $this->db($keyword, true) |
283 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
283 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
284 | 284 | $stm->execute(array( |
285 | - ':keyword' => $keyword, |
|
286 | - ':object' => $this->encode($value), |
|
287 | - ':exp' => time() + (int)$time, |
|
285 | + ':keyword' => $keyword, |
|
286 | + ':object' => $this->encode($value), |
|
287 | + ':exp' => time() + (int)$time, |
|
288 | 288 | )); |
289 | 289 | } catch (PDOException $e) { |
290 | 290 | return false; |
@@ -305,18 +305,18 @@ discard block |
||
305 | 305 | // return value if in caching |
306 | 306 | try { |
307 | 307 | $stm = $this->db($keyword) |
308 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
|
308 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
|
309 | 309 | $stm->execute(array( |
310 | - ':keyword' => $keyword, |
|
310 | + ':keyword' => $keyword, |
|
311 | 311 | )); |
312 | 312 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
313 | 313 | |
314 | 314 | } catch (PDOException $e) { |
315 | 315 | try { |
316 | 316 | $stm = $this->db($keyword, true) |
317 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
|
317 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
|
318 | 318 | $stm->execute(array( |
319 | - ':keyword' => $keyword, |
|
319 | + ':keyword' => $keyword, |
|
320 | 320 | )); |
321 | 321 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
322 | 322 | } catch (PDOException $e) { |
@@ -359,10 +359,10 @@ discard block |
||
359 | 359 | { |
360 | 360 | try { |
361 | 361 | $stm = $this->db($row[ 'keyword' ]) |
362 | - ->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) "); |
|
362 | + ->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) "); |
|
363 | 363 | $stm->execute(array( |
364 | - ':id' => $row[ 'id' ], |
|
365 | - ':U' => time(), |
|
364 | + ':id' => $row[ 'id' ], |
|
365 | + ':U' => time(), |
|
366 | 366 | )); |
367 | 367 | } catch (PDOException $e) { |
368 | 368 | return false; |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | { |
379 | 379 | try { |
380 | 380 | $stm = $this->db($keyword) |
381 | - ->prepare("DELETE FROM `caching` WHERE (`keyword`=:keyword) OR (`exp` <= :U)"); |
|
381 | + ->prepare("DELETE FROM `caching` WHERE (`keyword`=:keyword) OR (`exp` <= :U)"); |
|
382 | 382 | $stm->execute(array( |
383 | - ':keyword' => $keyword, |
|
384 | - ':U' => time(), |
|
383 | + ':keyword' => $keyword, |
|
384 | + ':U' => time(), |
|
385 | 385 | )); |
386 | 386 | } catch (PDOException $e) { |
387 | 387 | return false; |
@@ -396,9 +396,9 @@ discard block |
||
396 | 396 | public function driver_stats($option = array()) |
397 | 397 | { |
398 | 398 | $res = array( |
399 | - 'info' => '', |
|
400 | - 'size' => '', |
|
401 | - 'data' => '', |
|
399 | + 'info' => '', |
|
400 | + 'size' => '', |
|
401 | + 'data' => '', |
|
402 | 402 | ); |
403 | 403 | $total = 0; |
404 | 404 | $optimized = 0; |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | try { |
414 | 414 | $PDO = new PDO("sqlite:" . $file_path); |
415 | 415 | $PDO->setAttribute(PDO::ATTR_ERRMODE, |
416 | - PDO::ERRMODE_EXCEPTION); |
|
416 | + PDO::ERRMODE_EXCEPTION); |
|
417 | 417 | |
418 | 418 | $stm = $PDO->prepare("DELETE FROM `caching` WHERE `exp` <= :U"); |
419 | 419 | $stm->execute(array( |
420 | - ':U' => date('U'), |
|
420 | + ':U' => date('U'), |
|
421 | 421 | )); |
422 | 422 | |
423 | 423 | $PDO->exec('VACUUM;'); |
@@ -433,8 +433,8 @@ discard block |
||
433 | 433 | } |
434 | 434 | $res[ 'size' ] = $optimized; |
435 | 435 | $res[ 'info' ] = array( |
436 | - 'total before removing expired entries [bytes]' => $total, |
|
437 | - 'optimized after removing expired entries [bytes]' => $optimized, |
|
436 | + 'total before removing expired entries [bytes]' => $total, |
|
437 | + 'optimized after removing expired entries [bytes]' => $optimized, |
|
438 | 438 | ); |
439 | 439 | |
440 | 440 | return $res; |
@@ -467,9 +467,9 @@ discard block |
||
467 | 467 | { |
468 | 468 | try { |
469 | 469 | $stm = $this->db($keyword) |
470 | - ->prepare("SELECT COUNT(`id`) as `total` FROM `caching` WHERE `keyword`=:keyword"); |
|
470 | + ->prepare("SELECT COUNT(`id`) as `total` FROM `caching` WHERE `keyword`=:keyword"); |
|
471 | 471 | $stm->execute(array( |
472 | - ':keyword' => $keyword, |
|
472 | + ':keyword' => $keyword, |
|
473 | 473 | )); |
474 | 474 | $data = $stm->fetch(PDO::FETCH_ASSOC); |
475 | 475 | if ($data[ 'total' ] >= 1) { |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | $stm = $this->indexing->prepare("SELECT MAX(`db`) as `db` FROM `balancing`"); |
146 | 146 | $stm->execute(); |
147 | 147 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
148 | - if (!isset($row[ 'db' ])) { |
|
148 | + if (!isset($row['db'])) { |
|
149 | 149 | $db = 1; |
150 | - } elseif ($row[ 'db' ] <= 1) { |
|
150 | + } elseif ($row['db'] <= 1) { |
|
151 | 151 | $db = 1; |
152 | 152 | } else { |
153 | - $db = $row[ 'db' ]; |
|
153 | + $db = $row['db']; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // check file size |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | ':keyword' => $keyword, |
173 | 173 | )); |
174 | 174 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
175 | - if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
|
176 | - $db = $row[ 'db' ]; |
|
175 | + if (isset($row['db']) && $row['db'] != '') { |
|
176 | + $db = $row['db']; |
|
177 | 177 | } else { |
178 | 178 | /* |
179 | 179 | * Insert new to Indexing |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | /** |
205 | 205 | * init instant |
206 | 206 | */ |
207 | - if (!isset($this->instant[ $instant ])) { |
|
207 | + if (!isset($this->instant[$instant])) { |
|
208 | 208 | // check DB Files ready or not |
209 | 209 | $createTable = false; |
210 | 210 | if (!file_exists($this->path . '/db' . $instant) || $reset == true) { |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | $this->initDB($PDO); |
218 | 218 | } |
219 | 219 | |
220 | - $this->instant[ $instant ] = $PDO; |
|
220 | + $this->instant[$instant] = $PDO; |
|
221 | 221 | unset($PDO); |
222 | 222 | |
223 | 223 | } |
224 | 224 | |
225 | - return $this->instant[ $instant ]; |
|
225 | + return $this->instant[$instant]; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $time = 300, |
252 | 252 | $option = array() |
253 | 253 | ) { |
254 | - $skipExisting = isset($option[ 'skipExisting' ]) ? $option[ 'skipExisting' ] : false; |
|
254 | + $skipExisting = isset($option['skipExisting']) ? $option['skipExisting'] : false; |
|
255 | 255 | $toWrite = true; |
256 | 256 | |
257 | 257 | // check in cache first |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $stm->execute(array( |
273 | 273 | ':keyword' => $keyword, |
274 | 274 | ':object' => $this->encode($value), |
275 | - ':exp' => time() + (int)$time, |
|
275 | + ':exp' => time() + (int) $time, |
|
276 | 276 | )); |
277 | 277 | |
278 | 278 | return true; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $stm->execute(array( |
285 | 285 | ':keyword' => $keyword, |
286 | 286 | ':object' => $this->encode($value), |
287 | - ':exp' => time() + (int)$time, |
|
287 | + ':exp' => time() + (int) $time, |
|
288 | 288 | )); |
289 | 289 | } catch (PDOException $e) { |
290 | 290 | return false; |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | return null; |
331 | 331 | } |
332 | 332 | |
333 | - if (isset($row[ 'id' ])) { |
|
334 | - $data = $this->decode($row[ 'object' ]); |
|
333 | + if (isset($row['id'])) { |
|
334 | + $data = $this->decode($row['object']); |
|
335 | 335 | return $data; |
336 | 336 | } |
337 | 337 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | public function isExpired($row) |
346 | 346 | { |
347 | - if (isset($row[ 'exp' ]) && time() >= $row[ 'exp' ]) { |
|
347 | + if (isset($row['exp']) && time() >= $row['exp']) { |
|
348 | 348 | return true; |
349 | 349 | } |
350 | 350 | |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | public function deleteRow($row) |
359 | 359 | { |
360 | 360 | try { |
361 | - $stm = $this->db($row[ 'keyword' ]) |
|
361 | + $stm = $this->db($row['keyword']) |
|
362 | 362 | ->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) "); |
363 | 363 | $stm->execute(array( |
364 | - ':id' => $row[ 'id' ], |
|
364 | + ':id' => $row['id'], |
|
365 | 365 | ':U' => time(), |
366 | 366 | )); |
367 | 367 | } catch (PDOException $e) { |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | |
432 | 432 | } |
433 | 433 | } |
434 | - $res[ 'size' ] = $optimized; |
|
435 | - $res[ 'info' ] = array( |
|
434 | + $res['size'] = $optimized; |
|
435 | + $res['info'] = array( |
|
436 | 436 | 'total before removing expired entries [bytes]' => $total, |
437 | 437 | 'optimized after removing expired entries [bytes]' => $optimized, |
438 | 438 | ); |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | ':keyword' => $keyword, |
473 | 473 | )); |
474 | 474 | $data = $stm->fetch(PDO::FETCH_ASSOC); |
475 | - if ($data[ 'total' ] >= 1) { |
|
475 | + if ($data['total'] >= 1) { |
|
476 | 476 | return true; |
477 | 477 | } else { |
478 | 478 | return false; |
@@ -55,4 +55,4 @@ |
||
55 | 55 | echo '<br /><br /><a href="/">Back to index</a> -- <a href="/' . basename(__FILE__) . '">Reload</a>'; |
56 | 56 | |
57 | 57 | // Testing Functions |
58 | -require_once __DIR__."/TestingFunctions.php"; |
|
59 | 58 | \ No newline at end of file |
59 | +require_once __DIR__ . "/TestingFunctions.php"; |
|
60 | 60 | \ No newline at end of file |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | // Setup File Path on your config files |
28 | 28 | CacheManager::setup(array( |
29 | - // "path" => sys_get_temp_dir(), // or in windows "C:/tmp/" |
|
29 | + // "path" => sys_get_temp_dir(), // or in windows "C:/tmp/" |
|
30 | 30 | )); |
31 | 31 | // our unique method of caching, faster than traditional caching which shared everywhere on internet like 7-10 times |
32 | 32 | // reduce high load CPU, reduce I/O from files open |
@@ -61,5 +61,5 @@ |
||
61 | 61 | echo '<br /><br /><a href="/">Back to index</a> -- <a href="/' . basename(__FILE__) . '">Reload</a>'; |
62 | 62 | |
63 | 63 | // Testing Functions |
64 | -require_once __DIR__."/TestingFunctions.php"; |
|
64 | +require_once __DIR__ . "/TestingFunctions.php"; |
|
65 | 65 |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | |
37 | 37 | $keyword1 = "my_apple_keyword"; |
38 | 38 | $value1 = "Apple is good"; |
39 | -$cache->set($keyword1,$value1); |
|
39 | +$cache->set($keyword1, $value1); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | $keyword2 = "my_iphone_keyword"; |
43 | 43 | $value2 = "Android is better than iphone for sure"; |
44 | -$cache->set($keyword2,$value2); |
|
44 | +$cache->set($keyword2, $value2); |
|
45 | 45 | |
46 | 46 | |
47 | 47 | /// Time for the magic |
@@ -86,4 +86,4 @@ discard block |
||
86 | 86 | echo "<hr>"; |
87 | 87 | echo "<b>Testing Tags:</b>"; |
88 | 88 | |
89 | -include_once __DIR__."/Tags.YourCaching.php"; |
|
90 | 89 | \ No newline at end of file |
90 | +include_once __DIR__ . "/Tags.YourCaching.php"; |
|
91 | 91 | \ No newline at end of file |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | // You can also pass the setup directly to cache |
50 | 50 | $cache = CacheManager::Files($config); |
51 | -$cache = CacheManager::getInstance("Files",$config); |
|
51 | +$cache = CacheManager::getInstance("Files", $config); |
|
52 | 52 | |
53 | 53 | /************************************************** |
54 | 54 | * Overwrite Caching Driver |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | CacheManager::setup($config); |
65 | 65 | |
66 | 66 | $cache = CacheManager::getInstance(); // return Files Cache |
67 | -$cache_memcache = CacheManager::Memcached(); // return Files Cache |
|
68 | -$cache_apc = CacheManager::Apc(); // return Files Cache |
|
69 | -$cache_redis = CacheManager::Redis(); // return Files Cache |
|
67 | +$cache_memcache = CacheManager::Memcached(); // return Files Cache |
|
68 | +$cache_apc = CacheManager::Apc(); // return Files Cache |
|
69 | +$cache_redis = CacheManager::Redis(); // return Files Cache |
|
70 | 70 | |
71 | 71 | |
72 | 72 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * All you need is put this line on your config. |
8 | 8 | */ |
9 | 9 | |
10 | - // In your Setting / Config.php or Index.php |
|
10 | + // In your Setting / Config.php or Index.php |
|
11 | 11 | define("PHPFASTCACHE_LEGACY",true); |
12 | 12 | |
13 | 13 | // If you use composer, then it auto included our "src/phpFastCache/phpFastCache.php" on vendor folder already, you don't need to do anything else |
@@ -8,14 +8,14 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // In your Setting / Config.php or Index.php |
11 | - define("PHPFASTCACHE_LEGACY",true); |
|
11 | + define("PHPFASTCACHE_LEGACY", true); |
|
12 | 12 | |
13 | 13 | // If you use composer, then it auto included our "src/phpFastCache/phpFastCache.php" on vendor folder already, you don't need to do anything else |
14 | 14 | |
15 | - require_once __DIR__.'/../src/autoload.php'; |
|
15 | + require_once __DIR__ . '/../src/autoload.php'; |
|
16 | 16 | |
17 | 17 | // run Files Example |
18 | - require_once __DIR__.'/files.php'; |
|
18 | + require_once __DIR__ . '/files.php'; |
|
19 | 19 | |
20 | 20 | /* |
21 | 21 | * It also bring back the __c() legacy function |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | |
41 | 41 | $keyword1 = "my_apple_keyword"; |
42 | 42 | $value1 = "Apple is good"; |
43 | -$cache->set($keyword1,$value1, 300, array("tags" => array("apple","laptop","computer"))); |
|
43 | +$cache->set($keyword1, $value1, 300, array("tags" => array("apple", "laptop", "computer"))); |
|
44 | 44 | // OR: $cache->setTags($keyword1,$value1,300, array("computer","laptop")); |
45 | 45 | |
46 | 46 | |
47 | 47 | $keyword2 = "my_iphone_keyword"; |
48 | 48 | $value2 = "Android is better than iphone for sure"; |
49 | -$cache->setTags($keyword2,$value2, 800, array("apple","cellphone")); |
|
49 | +$cache->setTags($keyword2, $value2, 800, array("apple", "cellphone")); |
|
50 | 50 | |
51 | 51 | |
52 | 52 | /// Time for the magic |
53 | -$myAppleProducts = $cache->getTags(array("apple","laptop")); |
|
53 | +$myAppleProducts = $cache->getTags(array("apple", "laptop")); |
|
54 | 54 | echo "<pre>"; |
55 | 55 | print_r($myAppleProducts); |
56 | 56 | echo "</pre>"; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | |
82 | 82 | /// Just need Keywords & Expired Time, No Caching Contents => put false at end |
83 | -$myAppleProducts = $cache->getTags(array("apple","laptop"), false); |
|
83 | +$myAppleProducts = $cache->getTags(array("apple", "laptop"), false); |
|
84 | 84 | echo "<pre>"; |
85 | 85 | print_r($myAppleProducts); |
86 | 86 | echo "</pre>"; |
@@ -58,4 +58,4 @@ |
||
58 | 58 | echo '<br /><br /><a href="/">Back to index</a> -- <a href="/' . basename(__FILE__) . '">Reload</a>'; |
59 | 59 | |
60 | 60 | // Testing Functions |
61 | -require_once __DIR__."/TestingFunctions.php"; |
|
61 | +require_once __DIR__ . "/TestingFunctions.php"; |