@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | protected function driverRead(CacheItemInterface $item) |
78 | 78 | { |
79 | 79 | return [ |
80 | - self::DRIVER_DATA_WRAPPER_INDEX => null, |
|
81 | - self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
82 | - self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(), |
|
80 | + self::DRIVER_DATA_WRAPPER_INDEX => null, |
|
81 | + self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
82 | + self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(), |
|
83 | 83 | ]; |
84 | 84 | } |
85 | 85 | |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | { |
130 | 130 | $stat = new driverStatistic(); |
131 | 131 | $stat->setInfo('[Devnull] A void info string') |
132 | - ->setSize(0) |
|
133 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
134 | - ->setRawData(null); |
|
132 | + ->setSize(0) |
|
133 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
134 | + ->setRawData(null); |
|
135 | 135 | |
136 | 136 | return $stat; |
137 | 137 | } |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | protected function driverRead(CacheItemInterface $item) |
80 | 80 | { |
81 | 81 | return [ |
82 | - self::DRIVER_DATA_WRAPPER_INDEX => false, |
|
83 | - self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
84 | - self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(), |
|
82 | + self::DRIVER_DATA_WRAPPER_INDEX => false, |
|
83 | + self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
84 | + self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(), |
|
85 | 85 | ]; |
86 | 86 | } |
87 | 87 | /** |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | { |
131 | 131 | $stat = new driverStatistic(); |
132 | 132 | $stat->setInfo('[Devfalse] A void info string') |
133 | - ->setSize(0) |
|
134 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
135 | - ->setRawData(false); |
|
133 | + ->setSize(0) |
|
134 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
135 | + ->setRawData(false); |
|
136 | 136 | |
137 | 137 | return $stat; |
138 | 138 | } |
@@ -130,8 +130,8 @@ |
||
130 | 130 | */ |
131 | 131 | public function getStats() |
132 | 132 | { |
133 | - if(function_exists('zend_shm_cache_info')) { |
|
134 | - $stats = (array)zend_shm_cache_info(); |
|
133 | + if (function_exists('zend_shm_cache_info')) { |
|
134 | + $stats = (array) zend_shm_cache_info(); |
|
135 | 135 | return (new driverStatistic()) |
136 | 136 | ->setData(implode(', ', array_keys($this->namespaces))) |
137 | 137 | ->setInfo(sprintf("The Zend memory have %d item(s) in cache.\n For more information see RawData.", $stats['items_total'])) |
@@ -23,9 +23,9 @@ |
||
23 | 23 | $keys = []; |
24 | 24 | |
25 | 25 | $dirs = [ |
26 | - __DIR__ . '/../var/cache/IO-', |
|
27 | - sys_get_temp_dir() . '/phpfastcache/IO-1', |
|
28 | - sys_get_temp_dir() . '/phpfastcache/IO-2' |
|
26 | + __DIR__ . '/../var/cache/IO-', |
|
27 | + sys_get_temp_dir() . '/phpfastcache/IO-1', |
|
28 | + sys_get_temp_dir() . '/phpfastcache/IO-2' |
|
29 | 29 | ]; |
30 | 30 | |
31 | 31 |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | { |
40 | 40 | $cacheInstanceName = 'cacheInstance' . $i; |
41 | 41 | |
42 | - $instances[$dirIndex][$cacheInstanceName] = CacheManager::getInstance('Files',array('path' => $dir . str_pad($i, 3, '0', STR_PAD_LEFT))); |
|
42 | + $instances[$dirIndex][$cacheInstanceName] = CacheManager::getInstance('Files', array('path' => $dir . str_pad($i, 3, '0', STR_PAD_LEFT))); |
|
43 | 43 | |
44 | - foreach($keys[$dirIndex] as $index => $key) |
|
44 | + foreach ($keys[$dirIndex] as $index => $key) |
|
45 | 45 | { |
46 | 46 | $items[$dirIndex][$index] = $instances[$dirIndex][$cacheInstanceName]->getItem($key); |
47 | 47 | $items[$dirIndex][$index]->set("test-$dirIndex-$index")->expiresAfter(600); |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | $instances[$dirIndex][$cacheInstanceName]->detachAllItems(); |
52 | 52 | } |
53 | 53 | |
54 | - foreach($instances[$dirIndex] as $cacheInstanceName => $instance) |
|
54 | + foreach ($instances[$dirIndex] as $cacheInstanceName => $instance) |
|
55 | 55 | { |
56 | - foreach($keys[$dirIndex] as $index => $key) |
|
56 | + foreach ($keys[$dirIndex] as $index => $key) |
|
57 | 57 | { |
58 | - if($instances[$dirIndex][$cacheInstanceName]->getItem($key)->get() === "test-$dirIndex-$index") |
|
58 | + if ($instances[$dirIndex][$cacheInstanceName]->getItem($key)->get() === "test-$dirIndex-$index") |
|
59 | 59 | { |
60 | 60 | echo "[PASS] Item #{$key} of instance #{$cacheInstanceName} of dir #{$dirIndex} has returned the expected value (" . gettype("test-$dirIndex-$index") . ":'" . "test-$dirIndex-$index" . "')\n"; |
61 | 61 | } |
@@ -58,8 +58,7 @@ |
||
58 | 58 | if($instances[$dirIndex][$cacheInstanceName]->getItem($key)->get() === "test-$dirIndex-$index") |
59 | 59 | { |
60 | 60 | echo "[PASS] Item #{$key} of instance #{$cacheInstanceName} of dir #{$dirIndex} has returned the expected value (" . gettype("test-$dirIndex-$index") . ":'" . "test-$dirIndex-$index" . "')\n"; |
61 | - } |
|
62 | - else |
|
61 | + } else |
|
63 | 62 | { |
64 | 63 | echo "[FAIL] Item #{$key} of instance #{$cacheInstanceName} of dir #{$dirIndex} returned an unexpected value (" . gettype($instances[$dirIndex][$cacheInstanceName]->getItem($key)->get()) . ":'" . $instances[$dirIndex][$cacheInstanceName]->getItem($key)->get() . "') expected (" . gettype("test-$dirIndex-$index") . ":'" . "test-$dirIndex-$index" . "') \n"; |
65 | 64 | $status = 255; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $keyword = self::PREFIX . $item->getKey(); |
81 | 81 | $v = json_encode($this->driverPreWrap($item)); |
82 | 82 | |
83 | - if (isset($this->config[ 'limited_memory_each_object' ]) && strlen($v) > $this->config[ 'limited_memory_each_object' ]) { |
|
83 | + if (isset($this->config['limited_memory_each_object']) && strlen($v) > $this->config['limited_memory_each_object']) { |
|
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // return null if no caching |
102 | 102 | // return value if in caching |
103 | 103 | $keyword = self::PREFIX . $item->getKey(); |
104 | - $x = isset($_COOKIE[ $keyword ]) ? json_decode($_COOKIE[ $keyword ], true) : false; |
|
104 | + $x = isset($_COOKIE[$keyword]) ? json_decode($_COOKIE[$keyword], true) : false; |
|
105 | 105 | |
106 | 106 | if ($x == false) { |
107 | 107 | return null; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $this->driverConnect(); |
124 | 124 | $keyword = self::PREFIX . $key; |
125 | - $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ])->t) : false; |
|
125 | + $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword])->t) : false; |
|
126 | 126 | |
127 | 127 | return $x ? $x - time() : $x; |
128 | 128 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | if ($item instanceof Item) { |
141 | 141 | $this->driverConnect(); |
142 | 142 | $keyword = self::PREFIX . $item->getKey(); |
143 | - $_COOKIE[ $keyword ] = null; |
|
143 | + $_COOKIE[$keyword] = null; |
|
144 | 144 | |
145 | 145 | return @setcookie($keyword, null, -10); |
146 | 146 | } else { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $this->driverConnect(); |
158 | 158 | foreach ($_COOKIE as $keyword => $value) { |
159 | 159 | if (strpos($keyword, self::PREFIX) !== false) { |
160 | - $_COOKIE[ $keyword ] = null; |
|
160 | + $_COOKIE[$keyword] = null; |
|
161 | 161 | $result = @setcookie($keyword, null, -10); |
162 | 162 | if ($return !== false) { |
163 | 163 | $return = $result; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | protected function driverConnect() |
126 | 126 | { |
127 | - $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : []; |
|
127 | + $config = isset($this->config['predis']) ? $this->config['predis'] : []; |
|
128 | 128 | |
129 | 129 | $this->instance = new PredisClient(array_merge([ |
130 | 130 | 'host' => '127.0.0.1', |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $info = $this->instance->info(); |
151 | 151 | $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0); |
152 | 152 | $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0); |
153 | - $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date'); |
|
153 | + $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date'); |
|
154 | 154 | |
155 | 155 | return (new driverStatistic()) |
156 | 156 | ->setData(implode(', ', array_keys($this->itemInstances))) |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : []; |
128 | 128 | |
129 | 129 | $this->instance = new PredisClient(array_merge([ |
130 | - 'host' => '127.0.0.1', |
|
131 | - 'port' => 6379, |
|
132 | - 'password' => null, |
|
133 | - 'database' => null, |
|
130 | + 'host' => '127.0.0.1', |
|
131 | + 'port' => 6379, |
|
132 | + 'password' => null, |
|
133 | + 'database' => null, |
|
134 | 134 | ], $config)); |
135 | 135 | |
136 | 136 | return true; |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date'); |
154 | 154 | |
155 | 155 | return (new driverStatistic()) |
156 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
157 | - ->setRawData($this->instance->info()) |
|
158 | - ->setSize($size) |
|
159 | - ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $version, $date->format(DATE_RFC2822))); |
|
156 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
157 | + ->setRawData($this->instance->info()) |
|
158 | + ->setSize($size) |
|
159 | + ->setInfo(sprintf("The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.", $version, $date->format(DATE_RFC2822))); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | \ No newline at end of file |