@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $server = $this->config[ 'memcache' ]; |
77 | 77 | if (count($server) < 1) { |
78 | 78 | $server = array( |
79 | - array('127.0.0.1', 11211), |
|
79 | + array('127.0.0.1', 11211), |
|
80 | 80 | ); |
81 | 81 | } |
82 | 82 | |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | * @return array|bool |
108 | 108 | */ |
109 | 109 | public function driver_set( |
110 | - $keyword, |
|
111 | - $value = '', |
|
112 | - $time = 300, |
|
113 | - $option = array() |
|
110 | + $keyword, |
|
111 | + $value = '', |
|
112 | + $time = 300, |
|
113 | + $option = array() |
|
114 | 114 | ) { |
115 | 115 | $this->connectServer(); |
116 | 116 | |
@@ -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; |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | public function __construct($config = array()) |
42 | 42 | { |
43 | 43 | $this->setup($config); |
44 | - if (!$this->checkdriver() && !isset($config[ 'skipError' ])) { |
|
44 | + if (!$this->checkdriver() && !isset($config['skipError'])) { |
|
45 | 45 | $this->fallback = true; |
46 | 46 | } |
47 | 47 | if (class_exists('Memcache')) { |
48 | 48 | $this->instant = new MemcacheSoftware(); |
49 | 49 | |
50 | - if (array_key_exists('compress_data', $config) && $config[ 'compress_data' ] === true) { |
|
50 | + if (array_key_exists('compress_data', $config) && $config['compress_data'] === true) { |
|
51 | 51 | $this->memcacheFlags = MEMCACHE_COMPRESSED; |
52 | 52 | } |
53 | 53 | } else { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function connectServer() |
75 | 75 | { |
76 | - $server = $this->config[ 'memcache' ]; |
|
76 | + $server = $this->config['memcache']; |
|
77 | 77 | if (count($server) < 1) { |
78 | 78 | $server = array( |
79 | 79 | array('127.0.0.1', 11211), |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | foreach ($server as $s) { |
84 | - $name = $s[ 0 ] . "_" . $s[ 1 ]; |
|
85 | - if (!isset($this->checked[ $name ])) { |
|
84 | + $name = $s[0] . "_" . $s[1]; |
|
85 | + if (!isset($this->checked[$name])) { |
|
86 | 86 | try { |
87 | - if (!$this->instant->addserver($s[ 0 ], $s[ 1 ])) { |
|
87 | + if (!$this->instant->addserver($s[0], $s[1])) { |
|
88 | 88 | $this->fallback = true; |
89 | 89 | } |
90 | 90 | |
91 | - $this->checked[ $name ] = 1; |
|
91 | + $this->checked[$name] = 1; |
|
92 | 92 | } catch (\Exception $e) { |
93 | 93 | $this->fallback = true; |
94 | 94 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $time = time() + $time; |
121 | 121 | } |
122 | 122 | |
123 | - if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true) { |
|
123 | + if (isset($option['skipExisting']) && $option['skipExisting'] == true) { |
|
124 | 124 | return $this->instant->add($keyword, $value, $this->memcacheFlags, $time); |
125 | 125 | |
126 | 126 | } else { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function __construct($config = array()) |
32 | 32 | { |
33 | 33 | $this->setup($config); |
34 | - if (!$this->checkdriver() && !isset($config[ 'skipError' ])) { |
|
34 | + if (!$this->checkdriver() && !isset($config['skipError'])) { |
|
35 | 35 | $this->fallback = true; |
36 | 36 | } |
37 | 37 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function driver_set($keyword, $value = "", $time = 300, $option = array()) |
62 | 62 | { |
63 | 63 | |
64 | - if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true) { |
|
64 | + if (isset($option['skipExisting']) && $option['skipExisting'] == true) { |
|
65 | 65 | if (!$this->isExisting($keyword)) { |
66 | 66 | return xcache_set($keyword, serialize($value), $time); |
67 | 67 | } |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | ); |
111 | 111 | |
112 | 112 | try { |
113 | - $res[ 'data' ] = xcache_list(XC_TYPE_VAR, 100); |
|
113 | + $res['data'] = xcache_list(XC_TYPE_VAR, 100); |
|
114 | 114 | } catch (Exception $e) { |
115 | - $res[ 'data' ] = array(); |
|
115 | + $res['data'] = array(); |
|
116 | 116 | } |
117 | 117 | return $res; |
118 | 118 | } |
@@ -99,9 +99,9 @@ |
||
99 | 99 | public function driver_stats($option = array()) |
100 | 100 | { |
101 | 101 | $res = array( |
102 | - 'info' => '', |
|
103 | - 'size' => '', |
|
104 | - 'data' => '', |
|
102 | + 'info' => '', |
|
103 | + 'size' => '', |
|
104 | + 'data' => '', |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | return $res; |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | public function driver_stats($option = array()) |
171 | 171 | { |
172 | 172 | $res = array( |
173 | - 'info' => '', |
|
174 | - 'size' => '', |
|
175 | - 'data' => '', |
|
173 | + 'info' => '', |
|
174 | + 'size' => '', |
|
175 | + 'data' => '', |
|
176 | 176 | ); |
177 | 177 | |
178 | 178 | $path = $this->getPath(); |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | $key = $key[ 0 ]; |
206 | 206 | } |
207 | 207 | $content[ $key ] = array( |
208 | - 'size' => $size, |
|
209 | - 'write_time' => (isset($object[ 'write_time' ]) ? $object[ 'write_time' ] : null), |
|
208 | + 'size' => $size, |
|
209 | + 'write_time' => (isset($object[ 'write_time' ]) ? $object[ 'write_time' ] : null), |
|
210 | 210 | ); |
211 | 211 | if ($this->isExpired($object)) { |
212 | 212 | @unlink($file_path); |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | |
221 | 221 | $res[ 'size' ] = $total - $removed; |
222 | 222 | $res[ 'info' ] = array( |
223 | - 'Total [bytes]' => $total, |
|
224 | - 'Expired and removed [bytes]' => $removed, |
|
225 | - 'Current [bytes]' => $res[ 'size' ], |
|
223 | + 'Total [bytes]' => $total, |
|
224 | + 'Expired and removed [bytes]' => $removed, |
|
225 | + 'Current [bytes]' => $res[ 'size' ], |
|
226 | 226 | ); |
227 | 227 | $res[ "data" ] = $content; |
228 | 228 | return $res; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $this->setup($config); |
35 | 35 | $this->getPath(); // force create path |
36 | 36 | |
37 | - if (!$this->checkdriver() && !isset($config[ 'skipError' ])) { |
|
37 | + if (!$this->checkdriver() && !isset($config['skipError'])) { |
|
38 | 38 | throw new phpFastCacheDriverException("Can't use this driver for your website!"); |
39 | 39 | } |
40 | 40 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | /* |
97 | 97 | * Skip if Existing Caching in Options |
98 | 98 | */ |
99 | - if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true && file_exists($file_path)) { |
|
99 | + if (isset($option['skipExisting']) && $option['skipExisting'] == true && file_exists($file_path)) { |
|
100 | 100 | $content = $this->readfile($file_path); |
101 | 101 | $old = $this->decode($content); |
102 | 102 | $toWrite = false; |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | } else { |
203 | 203 | //Because PHP 5.3, this cannot be written in single line |
204 | 204 | $key = explode('.', $f); |
205 | - $key = $key[ 0 ]; |
|
205 | + $key = $key[0]; |
|
206 | 206 | } |
207 | - $content[ $key ] = array( |
|
207 | + $content[$key] = array( |
|
208 | 208 | 'size' => $size, |
209 | - 'write_time' => (isset($object[ 'write_time' ]) ? $object[ 'write_time' ] : null), |
|
209 | + 'write_time' => (isset($object['write_time']) ? $object['write_time'] : null), |
|
210 | 210 | ); |
211 | 211 | if ($this->isExpired($object)) { |
212 | 212 | @unlink($file_path); |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
221 | - $res[ 'size' ] = $total - $removed; |
|
222 | - $res[ 'info' ] = array( |
|
221 | + $res['size'] = $total - $removed; |
|
222 | + $res['info'] = array( |
|
223 | 223 | 'Total [bytes]' => $total, |
224 | 224 | 'Expired and removed [bytes]' => $removed, |
225 | - 'Current [bytes]' => $res[ 'size' ], |
|
225 | + 'Current [bytes]' => $res['size'], |
|
226 | 226 | ); |
227 | - $res[ "data" ] = $content; |
|
227 | + $res["data"] = $content; |
|
228 | 228 | return $res; |
229 | 229 | } |
230 | 230 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | */ |
298 | 298 | public function isExpired($object) |
299 | 299 | { |
300 | - if (isset($object[ 'expired_time' ]) && time() >= $object[ 'expired_time' ]) { |
|
300 | + if (isset($object['expired_time']) && time() >= $object['expired_time']) { |
|
301 | 301 | return true; |
302 | 302 | } else { |
303 | 303 | return false; |
@@ -101,9 +101,9 @@ |
||
101 | 101 | public function driver_stats($option = array()) |
102 | 102 | { |
103 | 103 | $res = array( |
104 | - 'info' => '', |
|
105 | - 'size' => '', |
|
106 | - 'data' => wincache_scache_info(), |
|
104 | + 'info' => '', |
|
105 | + 'size' => '', |
|
106 | + 'data' => wincache_scache_info(), |
|
107 | 107 | ); |
108 | 108 | return $res; |
109 | 109 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function __construct($config = array()) |
32 | 32 | { |
33 | 33 | $this->setup($config); |
34 | - if (!$this->checkdriver() && !isset($config[ 'skipError' ])) { |
|
34 | + if (!$this->checkdriver() && !isset($config['skipError'])) { |
|
35 | 35 | throw new phpFastCacheDriverException("Can't use this driver for your website!"); |
36 | 36 | } |
37 | 37 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function driver_set($keyword, $value = '', $time = 300, $option = array()) |
64 | 64 | { |
65 | - if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true) { |
|
65 | + if (isset($option['skipExisting']) && $option['skipExisting'] == true) { |
|
66 | 66 | // skip driver |
67 | 67 | } else { |
68 | 68 | // add driver |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | { |
63 | 63 | |
64 | 64 | $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : array( |
65 | - 'host' => "127.0.0.1", |
|
66 | - 'port' => 8888, |
|
67 | - 'password' => '', |
|
68 | - 'timeout' => 2000, |
|
65 | + 'host' => "127.0.0.1", |
|
66 | + 'port' => 8888, |
|
67 | + 'password' => '', |
|
68 | + 'timeout' => 2000, |
|
69 | 69 | ); |
70 | 70 | |
71 | 71 | if ($this->checked_ssdb === false) { |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | { |
155 | 155 | if ($this->connectServer()) { |
156 | 156 | $res = array( |
157 | - 'info' => '', |
|
158 | - 'size' => $this->instant->dbsize(), |
|
159 | - 'data' => $this->instant->info(), |
|
157 | + 'info' => '', |
|
158 | + 'size' => $this->instant->dbsize(), |
|
159 | + 'data' => $this->instant->info(), |
|
160 | 160 | ); |
161 | 161 | |
162 | 162 | return $res; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function __construct($config = array()) |
36 | 36 | { |
37 | 37 | $this->setup($config); |
38 | - if (!$this->checkdriver() && !isset($config[ 'skipError' ])) { |
|
38 | + if (!$this->checkdriver() && !isset($config['skipError'])) { |
|
39 | 39 | $this->fallback = true; |
40 | 40 | } |
41 | 41 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function connectServer() |
62 | 62 | { |
63 | 63 | |
64 | - $server = isset($this->config[ 'ssdb' ]) ? $this->config[ 'ssdb' ] : array( |
|
64 | + $server = isset($this->config['ssdb']) ? $this->config['ssdb'] : array( |
|
65 | 65 | 'host' => "127.0.0.1", |
66 | 66 | 'port' => 8888, |
67 | 67 | 'password' => '', |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | ); |
70 | 70 | |
71 | 71 | if ($this->checked_ssdb === false) { |
72 | - $host = $server[ 'host' ]; |
|
73 | - $port = isset($server[ 'port' ]) ? (int)$server[ 'port' ] : 8888; |
|
74 | - $password = isset($server[ 'password' ]) ? $server[ 'password' ] : ''; |
|
75 | - $timeout = !empty($server[ 'timeout' ]) ? (int)$server[ 'timeout' ] : 2000; |
|
72 | + $host = $server['host']; |
|
73 | + $port = isset($server['port']) ? (int) $server['port'] : 8888; |
|
74 | + $password = isset($server['password']) ? $server['password'] : ''; |
|
75 | + $timeout = !empty($server['timeout']) ? (int) $server['timeout'] : 2000; |
|
76 | 76 | $this->instant = new \SimpleSSDB($host, $port, $timeout); |
77 | 77 | if (!empty($password)) { |
78 | 78 | $this->instant->auth($password); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public function driver_set($keyword, $value = '', $time = 300, $option = array()) |
100 | 100 | { |
101 | 101 | if ($this->connectServer()) { |
102 | - if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true) { |
|
102 | + if (isset($option['skipExisting']) && $option['skipExisting'] == true) { |
|
103 | 103 | $x = $this->instant->get($keyword); |
104 | 104 | if ($x === false) { |
105 | 105 | return false; |
@@ -99,9 +99,9 @@ |
||
99 | 99 | public function driver_stats($option = array()) |
100 | 100 | { |
101 | 101 | $res = array( |
102 | - 'info' => '', |
|
103 | - 'size' => '', |
|
104 | - 'data' => '', |
|
102 | + 'info' => '', |
|
103 | + 'size' => '', |
|
104 | + 'data' => '', |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | return $res; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function __construct($config = array()) |
32 | 32 | { |
33 | 33 | $this->setup($config); |
34 | - if (!$this->checkdriver() && !isset($config[ 'skipError' ])) { |
|
34 | + if (!$this->checkdriver() && !isset($config['skipError'])) { |
|
35 | 35 | throw new phpFastCacheDriverException("Can't use this driver for your website!"); |
36 | 36 | } |
37 | 37 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function driver_set($keyword, $value = '', $time = 300, $option = array()) |
64 | 64 | { |
65 | - if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true) { |
|
65 | + if (isset($option['skipExisting']) && $option['skipExisting'] == true) { |
|
66 | 66 | // skip driver |
67 | 67 | } else { |
68 | 68 | // add driver |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | { |
67 | 67 | |
68 | 68 | $server = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : array( |
69 | - 'host' => '127.0.0.1', |
|
70 | - 'port' => '6379', |
|
71 | - 'password' => '', |
|
72 | - 'database' => '', |
|
69 | + 'host' => '127.0.0.1', |
|
70 | + 'port' => '6379', |
|
71 | + 'password' => '', |
|
72 | + 'database' => '', |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | |
76 | 76 | if ($this->checked_redis === false) { |
77 | 77 | $c = array( |
78 | - 'host' => $server[ 'host' ], |
|
78 | + 'host' => $server[ 'host' ], |
|
79 | 79 | ); |
80 | 80 | |
81 | 81 | $port = isset($server[ 'port' ]) ? $server[ 'port' ] : ''; |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | { |
183 | 183 | if ($this->connectServer()) { |
184 | 184 | $res = array( |
185 | - 'info' => '', |
|
186 | - 'size' => '', |
|
187 | - 'data' => $this->instant->info(), |
|
185 | + 'info' => '', |
|
186 | + 'size' => '', |
|
187 | + 'data' => $this->instant->info(), |
|
188 | 188 | ); |
189 | 189 | |
190 | 190 | return $res; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function connectServer() |
66 | 66 | { |
67 | 67 | |
68 | - $server = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : array( |
|
68 | + $server = isset($this->config['redis']) ? $this->config['redis'] : array( |
|
69 | 69 | 'host' => '127.0.0.1', |
70 | 70 | 'port' => '6379', |
71 | 71 | 'password' => '', |
@@ -75,32 +75,32 @@ discard block |
||
75 | 75 | |
76 | 76 | if ($this->checked_redis === false) { |
77 | 77 | $c = array( |
78 | - 'host' => $server[ 'host' ], |
|
78 | + 'host' => $server['host'], |
|
79 | 79 | ); |
80 | 80 | |
81 | - $port = isset($server[ 'port' ]) ? $server[ 'port' ] : ''; |
|
81 | + $port = isset($server['port']) ? $server['port'] : ''; |
|
82 | 82 | if ($port != '') { |
83 | - $c[ 'port' ] = $port; |
|
83 | + $c['port'] = $port; |
|
84 | 84 | } |
85 | 85 | |
86 | - $password = isset($server[ 'password' ]) ? $server[ 'password' ] : ''; |
|
86 | + $password = isset($server['password']) ? $server['password'] : ''; |
|
87 | 87 | if ($password != '') { |
88 | - $c[ 'password' ] = $password; |
|
88 | + $c['password'] = $password; |
|
89 | 89 | } |
90 | 90 | |
91 | - $database = isset($server[ 'database' ]) ? $server[ 'database' ] : ''; |
|
91 | + $database = isset($server['database']) ? $server['database'] : ''; |
|
92 | 92 | if ($database != '') { |
93 | - $c[ 'database' ] = $database; |
|
93 | + $c['database'] = $database; |
|
94 | 94 | } |
95 | 95 | |
96 | - $timeout = isset($server[ 'timeout' ]) ? $server[ 'timeout' ] : ''; |
|
96 | + $timeout = isset($server['timeout']) ? $server['timeout'] : ''; |
|
97 | 97 | if ($timeout != '') { |
98 | - $c[ 'timeout' ] = $timeout; |
|
98 | + $c['timeout'] = $timeout; |
|
99 | 99 | } |
100 | 100 | |
101 | - $read_write_timeout = isset($server[ 'read_write_timeout' ]) ? $server[ 'read_write_timeout' ] : ''; |
|
101 | + $read_write_timeout = isset($server['read_write_timeout']) ? $server['read_write_timeout'] : ''; |
|
102 | 102 | if ($read_write_timeout != '') { |
103 | - $c[ 'read_write_timeout' ] = $read_write_timeout; |
|
103 | + $c['read_write_timeout'] = $read_write_timeout; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | $this->instant = new PredisSoftware($c); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | if ($this->connectServer()) { |
131 | 131 | $value = $this->encode($value); |
132 | - if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true) { |
|
132 | + if (isset($option['skipExisting']) && $option['skipExisting'] == true) { |
|
133 | 133 | return $this->instant->setex($keyword, $time, $value); |
134 | 134 | } else { |
135 | 135 | return $this->instant->setex($keyword, $time, $value); |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | { |
67 | 67 | |
68 | 68 | $server = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : array( |
69 | - 'host' => '127.0.0.1', |
|
70 | - 'port' => '6379', |
|
71 | - 'password' => '', |
|
72 | - 'database' => '', |
|
73 | - 'timeout' => '1', |
|
69 | + 'host' => '127.0.0.1', |
|
70 | + 'port' => '6379', |
|
71 | + 'password' => '', |
|
72 | + 'database' => '', |
|
73 | + 'timeout' => '1', |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | if ($this->checked_redis === false) { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $value = $this->encode($value); |
133 | 133 | if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true) { |
134 | 134 | return $this->instant->set($keyword, $value, |
135 | - array('xx', 'ex' => $time)); |
|
135 | + array('xx', 'ex' => $time)); |
|
136 | 136 | } else { |
137 | 137 | return $this->instant->set($keyword, $value, $time); |
138 | 138 | } |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | { |
185 | 185 | if ($this->connectServer()) { |
186 | 186 | $res = array( |
187 | - 'info' => '', |
|
188 | - 'size' => '', |
|
189 | - 'data' => $this->instant->info(), |
|
187 | + 'info' => '', |
|
188 | + 'size' => '', |
|
189 | + 'data' => $this->instant->info(), |
|
190 | 190 | ); |
191 | 191 | |
192 | 192 | return $res; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function __construct($config = array()) |
37 | 37 | { |
38 | 38 | $this->setup($config); |
39 | - if (!$this->checkdriver() && !isset($config[ 'skipError' ])) { |
|
39 | + if (!$this->checkdriver() && !isset($config['skipError'])) { |
|
40 | 40 | $this->fallback = true; |
41 | 41 | } |
42 | 42 | if (class_exists('Redis')) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function connectServer() |
66 | 66 | { |
67 | 67 | |
68 | - $server = isset($this->config[ 'redis' ]) ? $this->config[ 'redis' ] : array( |
|
68 | + $server = isset($this->config['redis']) ? $this->config['redis'] : array( |
|
69 | 69 | 'host' => '127.0.0.1', |
70 | 70 | 'port' => '6379', |
71 | 71 | 'password' => '', |
@@ -75,41 +75,41 @@ discard block |
||
75 | 75 | |
76 | 76 | if ($this->checked_redis === false) { |
77 | 77 | |
78 | - $host = $server[ 'host' ]; |
|
78 | + $host = $server['host']; |
|
79 | 79 | |
80 | - $port = isset($server[ 'port' ]) ? (int)$server[ 'port' ] : ""; |
|
80 | + $port = isset($server['port']) ? (int) $server['port'] : ""; |
|
81 | 81 | if ($port != '') { |
82 | - $c[ 'port' ] = $port; |
|
82 | + $c['port'] = $port; |
|
83 | 83 | } |
84 | 84 | |
85 | - $password = isset($server[ 'password' ]) ? $server[ 'password' ] : ''; |
|
85 | + $password = isset($server['password']) ? $server['password'] : ''; |
|
86 | 86 | if ($password != '') { |
87 | - $c[ 'password' ] = $password; |
|
87 | + $c['password'] = $password; |
|
88 | 88 | } |
89 | 89 | |
90 | - $database = isset($server[ 'database' ]) ? $server[ 'database' ] : ''; |
|
90 | + $database = isset($server['database']) ? $server['database'] : ''; |
|
91 | 91 | if ($database != '') { |
92 | - $c[ 'database' ] = $database; |
|
92 | + $c['database'] = $database; |
|
93 | 93 | } |
94 | 94 | |
95 | - $timeout = isset($server[ 'timeout' ]) ? $server[ 'timeout' ] : ''; |
|
95 | + $timeout = isset($server['timeout']) ? $server['timeout'] : ''; |
|
96 | 96 | if ($timeout != '') { |
97 | - $c[ 'timeout' ] = $timeout; |
|
97 | + $c['timeout'] = $timeout; |
|
98 | 98 | } |
99 | 99 | |
100 | - $read_write_timeout = isset($server[ 'read_write_timeout' ]) ? $server[ 'read_write_timeout' ] : ''; |
|
100 | + $read_write_timeout = isset($server['read_write_timeout']) ? $server['read_write_timeout'] : ''; |
|
101 | 101 | if ($read_write_timeout != '') { |
102 | - $c[ 'read_write_timeout' ] = $read_write_timeout; |
|
102 | + $c['read_write_timeout'] = $read_write_timeout; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
106 | - if (!$this->instant->connect($host, (int)$port, (int)$timeout)) { |
|
106 | + if (!$this->instant->connect($host, (int) $port, (int) $timeout)) { |
|
107 | 107 | $this->checked_redis = true; |
108 | 108 | $this->fallback = true; |
109 | 109 | return false; |
110 | 110 | } else { |
111 | 111 | if ($database != '') { |
112 | - $this->instant->select((int)$database); |
|
112 | + $this->instant->select((int) $database); |
|
113 | 113 | } |
114 | 114 | $this->checked_redis = true; |
115 | 115 | return true; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | if ($this->connectServer()) { |
132 | 132 | $value = $this->encode($value); |
133 | - if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true) { |
|
133 | + if (isset($option['skipExisting']) && $option['skipExisting'] == true) { |
|
134 | 134 | return $this->instant->set($keyword, $value, |
135 | 135 | array('xx', 'ex' => $time)); |
136 | 136 | } else { |
@@ -120,9 +120,9 @@ |
||
120 | 120 | { |
121 | 121 | $this->connectServer(); |
122 | 122 | $res = array( |
123 | - 'info' => '', |
|
124 | - 'size' => '', |
|
125 | - 'data' => $_COOKIE, |
|
123 | + 'info' => '', |
|
124 | + 'size' => '', |
|
125 | + 'data' => $_COOKIE, |
|
126 | 126 | ); |
127 | 127 | |
128 | 128 | return $res; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function __construct($config = array()) |
30 | 30 | { |
31 | 31 | $this->setup($config); |
32 | - if (!$this->checkdriver() && !isset($config[ 'skipError' ])) { |
|
32 | + if (!$this->checkdriver() && !isset($config['skipError'])) { |
|
33 | 33 | $this->fallback = true; |
34 | 34 | } |
35 | 35 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function connectServer() |
54 | 54 | { |
55 | 55 | // for cookie check output |
56 | - if (!isset($_COOKIE[ 'phpFastCache' ])) { |
|
56 | + if (!isset($_COOKIE['phpFastCache'])) { |
|
57 | 57 | if (!@setcookie('phpFastCache', 1, 10)) { |
58 | 58 | $this->fallback = true; |
59 | 59 | } |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | $this->connectServer(); |
74 | 74 | $keyword = 'phpFastCache_' . $keyword; |
75 | 75 | $v = $this->encode($value); |
76 | - if(isset($this->config['limited_memory_each_object']) |
|
76 | + if (isset($this->config['limited_memory_each_object']) |
|
77 | 77 | && strlen($v) > $this->config['limited_memory_each_object']) { |
78 | 78 | return false; |
79 | 79 | } |
80 | - return setcookie($keyword, $v, time() + ($time ? (int)$time : 300), '/'); |
|
80 | + return setcookie($keyword, $v, time() + ($time ? (int) $time : 300), '/'); |
|
81 | 81 | |
82 | 82 | } |
83 | 83 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | // return null if no caching |
93 | 93 | // return value if in caching |
94 | 94 | $keyword = 'phpFastCache_' . $keyword; |
95 | - $x = isset($_COOKIE[ $keyword ]) ? $this->decode($_COOKIE[ $keyword ]) : false; |
|
95 | + $x = isset($_COOKIE[$keyword]) ? $this->decode($_COOKIE[$keyword]) : false; |
|
96 | 96 | if ($x == false) { |
97 | 97 | return null; |
98 | 98 | } else { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $this->connectServer(); |
110 | 110 | $keyword = 'phpFastCache_' . $keyword; |
111 | 111 | @setcookie($keyword, null, -10); |
112 | - $_COOKIE[ $keyword ] = null; |
|
112 | + $_COOKIE[$keyword] = null; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | foreach ($_COOKIE as $keyword => $value) { |
138 | 138 | if (strpos($keyword, 'phpFastCache') !== false) { |
139 | 139 | @setcookie($keyword, null, -10); |
140 | - $_COOKIE[ $keyword ] = null; |
|
140 | + $_COOKIE[$keyword] = null; |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | } |