@@ -8,23 +8,23 @@ |
||
| 8 | 8 | |
| 9 | 9 | use phpFastCache\CacheManager; |
| 10 | 10 | |
| 11 | - require_once __DIR__.'/../Core/DriverInterface.php'; |
|
| 12 | - require_once __DIR__.'/../Core/DriverAbstract.php'; |
|
| 13 | - require_once __DIR__.'/../Core/phpFastCache.php'; |
|
| 14 | - require_once __DIR__.'/../Core/phpFastCacheExtensions.php'; |
|
| 15 | - require_once __DIR__.'/../Exceptions/phpFastCacheCoreException.php'; |
|
| 16 | - require_once __DIR__.'/../Exceptions/phpFastCacheDriverException.php'; |
|
| 17 | - |
|
| 18 | - require_once __DIR__.'/../Drivers/files.php'; |
|
| 19 | - require_once __DIR__.'/../Drivers/memcache.php'; |
|
| 20 | - require_once __DIR__.'/../Drivers/memcached.php'; |
|
| 21 | - require_once __DIR__.'/../Drivers/mongodb.php'; |
|
| 22 | - require_once __DIR__.'/../Drivers/predis.php'; |
|
| 23 | - require_once __DIR__.'/../Drivers/redis.php'; |
|
| 24 | - require_once __DIR__.'/../Drivers/sqlite.php'; |
|
| 25 | - |
|
| 26 | - require_once __DIR__.'/../CacheManager.php'; |
|
| 27 | - require_once __DIR__.'/../phpFastCache.php'; |
|
| 11 | + require_once __DIR__ . '/../Core/DriverInterface.php'; |
|
| 12 | + require_once __DIR__ . '/../Core/DriverAbstract.php'; |
|
| 13 | + require_once __DIR__ . '/../Core/phpFastCache.php'; |
|
| 14 | + require_once __DIR__ . '/../Core/phpFastCacheExtensions.php'; |
|
| 15 | + require_once __DIR__ . '/../Exceptions/phpFastCacheCoreException.php'; |
|
| 16 | + require_once __DIR__ . '/../Exceptions/phpFastCacheDriverException.php'; |
|
| 17 | + |
|
| 18 | + require_once __DIR__ . '/../Drivers/files.php'; |
|
| 19 | + require_once __DIR__ . '/../Drivers/memcache.php'; |
|
| 20 | + require_once __DIR__ . '/../Drivers/memcached.php'; |
|
| 21 | + require_once __DIR__ . '/../Drivers/mongodb.php'; |
|
| 22 | + require_once __DIR__ . '/../Drivers/predis.php'; |
|
| 23 | + require_once __DIR__ . '/../Drivers/redis.php'; |
|
| 24 | + require_once __DIR__ . '/../Drivers/sqlite.php'; |
|
| 25 | + |
|
| 26 | + require_once __DIR__ . '/../CacheManager.php'; |
|
| 27 | + require_once __DIR__ . '/../phpFastCache.php'; |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -30,4 +30,4 @@ |
||
| 30 | 30 | |
| 31 | 31 | // clean up expired files cache every hour |
| 32 | 32 | // For now only "files" drivers is supported |
| 33 | -$cache->autoCleanExpired(3600*1); |
|
| 34 | 33 | \ No newline at end of file |
| 34 | +$cache->autoCleanExpired(3600 * 1); |
|
| 35 | 35 | \ No newline at end of file |
@@ -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 { |
@@ -104,9 +104,9 @@ |
||
| 104 | 104 | public function driver_stats($option = array()) |
| 105 | 105 | { |
| 106 | 106 | $res = array( |
| 107 | - 'info' => '', |
|
| 108 | - 'size' => '', |
|
| 109 | - 'data' => '', |
|
| 107 | + 'info' => '', |
|
| 108 | + 'size' => '', |
|
| 109 | + 'data' => '', |
|
| 110 | 110 | ); |
| 111 | 111 | |
| 112 | 112 | try { |
@@ -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 | } |
@@ -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 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | public function __construct($config = array()) |
| 31 | 31 | { |
| 32 | 32 | $this->setup($config); |
| 33 | - if (!$this->checkdriver() && !isset($config[ 'skipError' ])) { |
|
| 33 | + if (!$this->checkdriver() && !isset($config['skipError'])) { |
|
| 34 | 34 | $this->fallback = true; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function driver_set($keyword, $value = "", $time = 300, $option = array()) |
| 60 | 60 | { |
| 61 | - if (isset($option[ 'skipExisting' ]) && $option[ 'skipExisting' ] == true) { |
|
| 61 | + if (isset($option['skipExisting']) && $option['skipExisting'] == true) { |
|
| 62 | 62 | return wincache_ucache_add($keyword, $value, $time); |
| 63 | 63 | } else { |
| 64 | 64 | return wincache_ucache_set($keyword, $value, $time); |
@@ -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); |