@@ -33,20 +33,20 @@ |
||
33 | 33 | $cacheResult = $cacheInstance->getItem($cacheKey)->get(); |
34 | 34 | |
35 | 35 | if($cacheResult === $randomStr){ |
36 | - echo "[PASS] The cache key value match, got expected value '{$cacheResult}'\n"; |
|
36 | + echo "[PASS] The cache key value match, got expected value '{$cacheResult}'\n"; |
|
37 | 37 | }else{ |
38 | - echo "[FAIL] The cache key value match expected value '{$randomStr}', got '{$cacheResult}'\n"; |
|
39 | - $status = 1; |
|
38 | + echo "[FAIL] The cache key value match expected value '{$randomStr}', got '{$cacheResult}'\n"; |
|
39 | + $status = 1; |
|
40 | 40 | } |
41 | 41 | echo "Clearing the whole cache to test item cleaning...\n"; |
42 | 42 | $cacheInstance->clear(); |
43 | 43 | $cacheResult = ($cacheInstance->getItem($cacheKey)->isHit() === false && $cacheInstance->getItem($cacheKey)->get() === null); |
44 | 44 | |
45 | 45 | if($cacheResult === true){ |
46 | - echo "[PASS] The cache item is null as expected\n"; |
|
46 | + echo "[PASS] The cache item is null as expected\n"; |
|
47 | 47 | }else{ |
48 | - echo "[FAIL] The cache is not null'\n"; |
|
49 | - $status = 1; |
|
48 | + echo "[FAIL] The cache is not null'\n"; |
|
49 | + $status = 1; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | exit($status); |
53 | 53 | \ No newline at end of file |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | $cacheResult = $cacheInstance->getItem($cacheKey)->get(); |
34 | 34 | |
35 | -if($cacheResult === $randomStr){ |
|
35 | +if ($cacheResult === $randomStr) { |
|
36 | 36 | echo "[PASS] The cache key value match, got expected value '{$cacheResult}'\n"; |
37 | -}else{ |
|
37 | +} else { |
|
38 | 38 | echo "[FAIL] The cache key value match expected value '{$randomStr}', got '{$cacheResult}'\n"; |
39 | 39 | $status = 1; |
40 | 40 | } |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | $cacheInstance->clear(); |
43 | 43 | $cacheResult = ($cacheInstance->getItem($cacheKey)->isHit() === false && $cacheInstance->getItem($cacheKey)->get() === null); |
44 | 44 | |
45 | -if($cacheResult === true){ |
|
45 | +if ($cacheResult === true) { |
|
46 | 46 | echo "[PASS] The cache item is null as expected\n"; |
47 | -}else{ |
|
47 | +} else { |
|
48 | 48 | echo "[FAIL] The cache is not null'\n"; |
49 | 49 | $status = 1; |
50 | 50 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | if (!class_exists('phpFastCache\CacheManager')) { |
19 | 19 | echo "[FAIL] Autoload failed to find the CacheManager\n"; |
20 | 20 | $status = 255; |
21 | -}else{ |
|
21 | +} else{ |
|
22 | 22 | echo "[PASS] Autoload successfully found the CacheManager\n"; |
23 | 23 | } |
24 | 24 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | if (!interface_exists('Psr\Cache\CacheItemInterface')) { |
29 | 29 | echo "[FAIL] Autoload failed to find the Psr CacheItemInterface\n"; |
30 | 30 | $status = 255; |
31 | -}else{ |
|
31 | +} else{ |
|
32 | 32 | echo "[PASS] Autoload successfully found the Psr CacheItemInterface\n"; |
33 | 33 | } |
34 | 34 |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | { |
30 | 30 | use DriverBaseTrait; |
31 | 31 | |
32 | - /** |
|
33 | - * @var array |
|
34 | - */ |
|
32 | + /** |
|
33 | + * @var array |
|
34 | + */ |
|
35 | 35 | protected $staticStack = []; |
36 | 36 | |
37 | 37 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | $key = md5($item->getKey()); |
87 | 87 | if(isset($this->staticStack[$key])){ |
88 | - return $this->staticStack[$key]; |
|
88 | + return $this->staticStack[$key]; |
|
89 | 89 | } |
90 | 90 | return null; |
91 | 91 | } |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | * Check for Cross-Driver type confusion |
102 | 102 | */ |
103 | 103 | if ($item instanceof Item) { |
104 | - $key = md5($item->getKey()); |
|
105 | - if(isset($this->staticStack[$key])){ |
|
106 | - unset($this->staticStack[$key]); |
|
107 | - return true; |
|
108 | - } |
|
109 | - return false; |
|
104 | + $key = md5($item->getKey()); |
|
105 | + if(isset($this->staticStack[$key])){ |
|
106 | + unset($this->staticStack[$key]); |
|
107 | + return true; |
|
108 | + } |
|
109 | + return false; |
|
110 | 110 | } else { |
111 | 111 | throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
112 | 112 | } |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function driverClear() |
119 | 119 | { |
120 | - unset($this->staticStack); |
|
121 | - $this->staticStack = []; |
|
122 | - return true; |
|
120 | + unset($this->staticStack); |
|
121 | + $this->staticStack = []; |
|
122 | + return true; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | { |
144 | 144 | $stat = new driverStatistic(); |
145 | 145 | $stat->setInfo('[Memstatic] A memory static driver') |
146 | - ->setSize(mb_strlen(serialize($this->staticStack))) |
|
147 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
148 | - ->setRawData($this->staticStack); |
|
146 | + ->setSize(mb_strlen(serialize($this->staticStack))) |
|
147 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
148 | + ->setRawData($this->staticStack); |
|
149 | 149 | |
150 | 150 | return $stat; |
151 | 151 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | protected function driverRead(CacheItemInterface $item) |
85 | 85 | { |
86 | 86 | $key = md5($item->getKey()); |
87 | - if(isset($this->staticStack[$key])){ |
|
87 | + if (isset($this->staticStack[$key])) { |
|
88 | 88 | return $this->staticStack[$key]; |
89 | 89 | } |
90 | 90 | return null; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | if ($item instanceof Item) { |
104 | 104 | $key = md5($item->getKey()); |
105 | - if(isset($this->staticStack[$key])){ |
|
105 | + if (isset($this->staticStack[$key])) { |
|
106 | 106 | unset($this->staticStack[$key]); |
107 | 107 | return true; |
108 | 108 | } |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | * @var ExtendedCacheItemPoolInterface[] |
57 | 57 | */ |
58 | 58 | protected static $config = [ |
59 | - 'itemDetailedDate' => false,// Specify if the item must provide detailed creation/modification dates |
|
60 | - 'autoTmpFallback' => false,// Automatically attempt to fallback to temporary directory if the cache fails to write on the specified directory |
|
61 | - 'secureFileManipulation' => false,// Provide a secure file manipulation mechanism, on intensive usage the performance can be affected. |
|
62 | - 'ignoreSymfonyNotice' => false,// Ignore Symfony notice for Symfony project which do not makes use of PhpFastCache's Symfony Bundle |
|
63 | - 'defaultTtl' => 900,// Default time-to-live in second |
|
64 | - 'securityKey' => 'auto',// The securityKey that will be used to create sub-directory |
|
65 | - 'htaccess' => true,// Auto-generate .htaccess if tit is missing |
|
66 | - 'default_chmod' => 0777, // 0777 recommended |
|
67 | - 'path' => '',// if not set will be the value of sys_get_temp_dir() |
|
68 | - 'fallback' => false, //Fall back when old driver is not support |
|
69 | - 'limited_memory_each_object' => 4096, // maximum size (bytes) of object store in memory |
|
70 | - 'compress_data' => false, // compress stored data, if the backend supports it |
|
59 | + 'itemDetailedDate' => false,// Specify if the item must provide detailed creation/modification dates |
|
60 | + 'autoTmpFallback' => false,// Automatically attempt to fallback to temporary directory if the cache fails to write on the specified directory |
|
61 | + 'secureFileManipulation' => false,// Provide a secure file manipulation mechanism, on intensive usage the performance can be affected. |
|
62 | + 'ignoreSymfonyNotice' => false,// Ignore Symfony notice for Symfony project which do not makes use of PhpFastCache's Symfony Bundle |
|
63 | + 'defaultTtl' => 900,// Default time-to-live in second |
|
64 | + 'securityKey' => 'auto',// The securityKey that will be used to create sub-directory |
|
65 | + 'htaccess' => true,// Auto-generate .htaccess if tit is missing |
|
66 | + 'default_chmod' => 0777, // 0777 recommended |
|
67 | + 'path' => '',// if not set will be the value of sys_get_temp_dir() |
|
68 | + 'fallback' => false, //Fall back when old driver is not support |
|
69 | + 'limited_memory_each_object' => 4096, // maximum size (bytes) of object store in memory |
|
70 | + 'compress_data' => false, // compress stored data, if the backend supports it |
|
71 | 71 | ]; |
72 | 72 | |
73 | 73 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | } |
123 | 123 | } else if(++$badPracticeOmeter[$driver] >= 5){ |
124 | - trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
|
124 | + trigger_error('[' . $driver . '] Calling many times CacheManager::getInstance() for already instanced drivers is a bad practice and have a significant impact on performances. |
|
125 | 125 | See https://github.com/PHPSocialNetwork/phpfastcache/wiki/[V5]-Why-calling-getInstance%28%29-each-time-is-a-bad-practice-%3F'); |
126 | 126 | } |
127 | 127 | |
@@ -260,22 +260,22 @@ discard block |
||
260 | 260 | public static function getStaticSystemDrivers() |
261 | 261 | { |
262 | 262 | return [ |
263 | - 'Apc', |
|
264 | - 'Apcu', |
|
265 | - 'Couchbase', |
|
266 | - 'Devnull', |
|
267 | - 'Files', |
|
268 | - 'Leveldb', |
|
269 | - 'Memcache', |
|
270 | - 'Memcached', |
|
271 | - 'Memstatic', |
|
272 | - 'Mongodb', |
|
273 | - 'Predis', |
|
274 | - 'Redis', |
|
275 | - 'Ssdb', |
|
276 | - 'Sqlite', |
|
277 | - 'Wincache', |
|
278 | - 'Xcache', |
|
263 | + 'Apc', |
|
264 | + 'Apcu', |
|
265 | + 'Couchbase', |
|
266 | + 'Devnull', |
|
267 | + 'Files', |
|
268 | + 'Leveldb', |
|
269 | + 'Memcache', |
|
270 | + 'Memcached', |
|
271 | + 'Memstatic', |
|
272 | + 'Mongodb', |
|
273 | + 'Predis', |
|
274 | + 'Redis', |
|
275 | + 'Ssdb', |
|
276 | + 'Sqlite', |
|
277 | + 'Wincache', |
|
278 | + 'Xcache', |
|
279 | 279 | ]; |
280 | 280 | } |
281 | 281 |