@@ -100,7 +100,7 @@ |
||
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | 102 | * @param \Psr\Cache\CacheItemInterface $item |
| 103 | - * @return bool |
|
| 103 | + * @return integer |
|
| 104 | 104 | * @throws phpFastCacheInvalidArgumentException |
| 105 | 105 | */ |
| 106 | 106 | protected function driverDelete(CacheItemInterface $item) |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | * @see https://redis.io/commands/setex |
| 75 | 75 | * @see https://redis.io/commands/expire |
| 76 | 76 | */ |
| 77 | - if($ttl <= 0){ |
|
| 77 | + if ($ttl <= 0) { |
|
| 78 | 78 | return $this->instance->expire($item->getKey(), 0); |
| 79 | - }else{ |
|
| 79 | + } else { |
|
| 80 | 80 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item))); |
| 81 | 81 | } |
| 82 | 82 | } else { |
@@ -134,31 +134,31 @@ discard block |
||
| 134 | 134 | } else { |
| 135 | 135 | $this->instance = $this->instance ?: new RedisClient(); |
| 136 | 136 | |
| 137 | - $host = isset($this->config[ 'host' ]) ? (string) $this->config[ 'host' ] : '127.0.0.1'; |
|
| 138 | - $path = isset($this->config[ 'path' ]) ? (string) $this->config[ 'path' ] : false; |
|
| 139 | - $port = isset($this->config[ 'port' ]) ? (int) $this->config[ 'port' ] : 6379; |
|
| 140 | - $password = isset($this->config[ 'password' ]) ? (string) $this->config[ 'password' ] : ''; |
|
| 141 | - $database = isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : false; |
|
| 142 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : ''; |
|
| 137 | + $host = isset($this->config['host']) ? (string) $this->config['host'] : '127.0.0.1'; |
|
| 138 | + $path = isset($this->config['path']) ? (string) $this->config['path'] : false; |
|
| 139 | + $port = isset($this->config['port']) ? (int) $this->config['port'] : 6379; |
|
| 140 | + $password = isset($this->config['password']) ? (string) $this->config['password'] : ''; |
|
| 141 | + $database = isset($this->config['database']) ? $this->config['database'] : false; |
|
| 142 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : ''; |
|
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * If path is provided we consider it as an UNIX Socket |
| 146 | 146 | */ |
| 147 | - if($path){ |
|
| 147 | + if ($path) { |
|
| 148 | 148 | $isConnected = $this->instance->connect($path); |
| 149 | - }else{ |
|
| 150 | - $isConnected = $this->instance->connect($host, (int)$port, (int)$timeout); |
|
| 149 | + } else { |
|
| 150 | + $isConnected = $this->instance->connect($host, (int) $port, (int) $timeout); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (!$isConnected && $path) { |
| 154 | 154 | return false; |
| 155 | - } else if(!$path) { |
|
| 155 | + } else if (!$path) { |
|
| 156 | 156 | if ($password && !$this->instance->auth($password)) { |
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | if ($database !== false) { |
| 161 | - $this->instance->select((int)$database); |
|
| 161 | + $this->instance->select((int) $database); |
|
| 162 | 162 | } |
| 163 | 163 | return true; |
| 164 | 164 | } |
@@ -177,13 +177,13 @@ discard block |
||
| 177 | 177 | { |
| 178 | 178 | // used_memory |
| 179 | 179 | $info = $this->instance->info(); |
| 180 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
|
| 180 | + $date = (new \DateTime())->setTimestamp(time() - $info['uptime_in_seconds']); |
|
| 181 | 181 | |
| 182 | 182 | return (new DriverStatistic()) |
| 183 | 183 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 184 | 184 | ->setRawData($info) |
| 185 | - ->setSize($info[ 'used_memory' ]) |
|
| 185 | + ->setSize($info['used_memory']) |
|
| 186 | 186 | ->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.", |
| 187 | - $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
| 187 | + $info['redis_version'], $date->format(DATE_RFC2822))); |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | \ No newline at end of file |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | if($ttl <= 0){ |
| 78 | 78 | return $this->instance->expire($item->getKey(), 0); |
| 79 | - }else{ |
|
| 79 | + } else{ |
|
| 80 | 80 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item))); |
| 81 | 81 | } |
| 82 | 82 | } else { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | if($path){ |
| 148 | 148 | $isConnected = $this->instance->connect($path); |
| 149 | - }else{ |
|
| 149 | + } else{ |
|
| 150 | 150 | $isConnected = $this->instance->connect($host, (int)$port, (int)$timeout); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -135,13 +135,13 @@ discard block |
||
| 135 | 135 | $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
| 136 | 136 | if (count($servers) < 1) { |
| 137 | 137 | $servers = [ |
| 138 | - [ |
|
| 138 | + [ |
|
| 139 | 139 | 'host' => '127.0.0.1', |
| 140 | 140 | 'path' => false, |
| 141 | 141 | 'port' => 11211, |
| 142 | 142 | 'sasl_user' => false, |
| 143 | 143 | 'sasl_password' => false, |
| 144 | - ], |
|
| 144 | + ], |
|
| 145 | 145 | ]; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -184,9 +184,9 @@ discard block |
||
| 184 | 184 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
| 185 | 185 | |
| 186 | 186 | return (new DriverStatistic()) |
| 187 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 188 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 189 | - ->setRawData($stats) |
|
| 190 | - ->setSize($stats[ 'bytes' ]); |
|
| 187 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 188 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 189 | + ->setRawData($stats) |
|
| 190 | + ->setSize($stats[ 'bytes' ]); |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | \ No newline at end of file |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | */ |
| 153 | 153 | if(!empty($server[ 'path' ]) && !$this->instance->addServer($server[ 'path' ], 0)){ |
| 154 | 154 | $this->fallback = true; |
| 155 | - }else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 155 | + } else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 156 | 156 | $this->fallback = true; |
| 157 | 157 | } |
| 158 | 158 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $this->instance = new MemcachedSoftware(); |
| 134 | 134 | $this->instance->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); |
| 135 | - $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
|
| 135 | + $servers = (!empty($this->config['servers']) && is_array($this->config['servers']) ? $this->config['servers'] : []); |
|
| 136 | 136 | if (count($servers) < 1) { |
| 137 | 137 | $servers = [ |
| 138 | 138 | [ |
@@ -150,14 +150,14 @@ discard block |
||
| 150 | 150 | /** |
| 151 | 151 | * If path is provided we consider it as an UNIX Socket |
| 152 | 152 | */ |
| 153 | - if(!empty($server[ 'path' ]) && !$this->instance->addServer($server[ 'path' ], 0)){ |
|
| 153 | + if (!empty($server['path']) && !$this->instance->addServer($server['path'], 0)) { |
|
| 154 | 154 | $this->fallback = true; |
| 155 | - }else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 155 | + } else if (!empty($server['host']) && !$this->instance->addServer($server['host'], $server['port'])) { |
|
| 156 | 156 | $this->fallback = true; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if (!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password' ])) { |
|
| 160 | - $this->instance->setSaslAuthData($server[ 'sasl_user' ], $server[ 'sasl_password' ]); |
|
| 159 | + if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) { |
|
| 160 | + $this->instance->setSaslAuthData($server['sasl_user'], $server['sasl_password']); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | } catch (\Exception $e) { |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * any error if not connected ... |
| 171 | 171 | */ |
| 172 | 172 | $version = $this->instance->getVersion(); |
| 173 | - if(!$version || $this->instance->getResultCode() !== MemcachedSoftware::RES_SUCCESS){ |
|
| 173 | + if (!$version || $this->instance->getResultCode() !== MemcachedSoftware::RES_SUCCESS) { |
|
| 174 | 174 | throw new phpFastCacheDriverException('Memcached seems to not be connected'); |
| 175 | 175 | } |
| 176 | 176 | return true; |
@@ -188,16 +188,16 @@ discard block |
||
| 188 | 188 | public function getStats() |
| 189 | 189 | { |
| 190 | 190 | $stats = current($this->instance->getStats()); |
| 191 | - $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
| 192 | - $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : $this->instance->getVersion()); |
|
| 193 | - $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
| 191 | + $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0); |
|
| 192 | + $stats['version'] = (isset($stats['version']) ? $stats['version'] : $this->instance->getVersion()); |
|
| 193 | + $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0); |
|
| 194 | 194 | |
| 195 | - $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
| 195 | + $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']); |
|
| 196 | 196 | |
| 197 | 197 | return (new DriverStatistic()) |
| 198 | 198 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 199 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 199 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
| 200 | 200 | ->setRawData($stats) |
| 201 | - ->setSize($stats[ 'bytes' ]); |
|
| 201 | + ->setSize($stats['bytes']); |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | \ No newline at end of file |
@@ -138,10 +138,10 @@ discard block |
||
| 138 | 138 | $path = isset($config[ 'path' ]) ? (string) $config[ 'path' ] : false; |
| 139 | 139 | |
| 140 | 140 | $defaultConfig = [ |
| 141 | - 'host' => '127.0.0.1', |
|
| 142 | - 'port' => 6379, |
|
| 143 | - 'password' => null, |
|
| 144 | - 'database' => null, |
|
| 141 | + 'host' => '127.0.0.1', |
|
| 142 | + 'port' => 6379, |
|
| 143 | + 'password' => null, |
|
| 144 | + 'database' => null, |
|
| 145 | 145 | ]; |
| 146 | 146 | $config = array_merge($defaultConfig, $config); |
| 147 | 147 | |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | if($path){ |
| 152 | 152 | $this->instance = new PredisClient([ |
| 153 | - 'scheme' => 'unix', |
|
| 154 | - 'path' => $path |
|
| 153 | + 'scheme' => 'unix', |
|
| 154 | + 'path' => $path |
|
| 155 | 155 | ]); |
| 156 | 156 | }else{ |
| 157 | 157 | $this->instance = new PredisClient($config); |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
| 198 | 198 | |
| 199 | 199 | return (new DriverStatistic()) |
| 200 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 201 | - ->setRawData($info) |
|
| 202 | - ->setSize($size) |
|
| 203 | - ->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.", |
|
| 200 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 201 | + ->setRawData($info) |
|
| 202 | + ->setSize($size) |
|
| 203 | + ->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.", |
|
| 204 | 204 | $version, $date->format(DATE_RFC2822))); |
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | \ No newline at end of file |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | * @see https://redis.io/commands/setex |
| 79 | 79 | * @see https://redis.io/commands/expire |
| 80 | 80 | */ |
| 81 | - if($ttl <= 0){ |
|
| 81 | + if ($ttl <= 0) { |
|
| 82 | 82 | return $this->instance->expire($item->getKey(), 0); |
| 83 | - }else{ |
|
| 83 | + } else { |
|
| 84 | 84 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item))); |
| 85 | 85 | } |
| 86 | 86 | } else { |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | protected function driverConnect() |
| 135 | 135 | { |
| 136 | 136 | /** Backward compatibility */ |
| 137 | - $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : $this->config; |
|
| 138 | - $path = isset($config[ 'path' ]) ? (string) $config[ 'path' ] : false; |
|
| 137 | + $config = isset($this->config['predis']) ? $this->config['predis'] : $this->config; |
|
| 138 | + $path = isset($config['path']) ? (string) $config['path'] : false; |
|
| 139 | 139 | |
| 140 | 140 | $defaultConfig = [ |
| 141 | 141 | 'host' => '127.0.0.1', |
@@ -148,12 +148,12 @@ discard block |
||
| 148 | 148 | /** |
| 149 | 149 | * If path is provided we consider it as an UNIX Socket |
| 150 | 150 | */ |
| 151 | - if($path){ |
|
| 151 | + if ($path) { |
|
| 152 | 152 | $this->instance = new PredisClient([ |
| 153 | 153 | 'scheme' => 'unix', |
| 154 | 154 | 'path' => $path |
| 155 | 155 | ]); |
| 156 | - }else{ |
|
| 156 | + } else { |
|
| 157 | 157 | $this->instance = new PredisClient($config); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | public function getStats() |
| 193 | 193 | { |
| 194 | 194 | $info = $this->instance->info(); |
| 195 | - $size = (isset($info[ 'Memory' ][ 'used_memory' ]) ? $info[ 'Memory' ][ 'used_memory' ] : 0); |
|
| 196 | - $version = (isset($info[ 'Server' ][ 'redis_version' ]) ? $info[ 'Server' ][ 'redis_version' ] : 0); |
|
| 197 | - $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
|
| 195 | + $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0); |
|
| 196 | + $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0); |
|
| 197 | + $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date'); |
|
| 198 | 198 | |
| 199 | 199 | return (new DriverStatistic()) |
| 200 | 200 | ->setData(implode(', ', array_keys($this->itemInstances))) |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | if($ttl <= 0){ |
| 82 | 82 | return $this->instance->expire($item->getKey(), 0); |
| 83 | - }else{ |
|
| 83 | + } else{ |
|
| 84 | 84 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item))); |
| 85 | 85 | } |
| 86 | 86 | } else { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | 'scheme' => 'unix', |
| 154 | 154 | 'path' => $path |
| 155 | 155 | ]); |
| 156 | - }else{ |
|
| 156 | + } else{ |
|
| 157 | 157 | $this->instance = new PredisClient($config); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -135,13 +135,13 @@ discard block |
||
| 135 | 135 | $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
| 136 | 136 | if (count($servers) < 1) { |
| 137 | 137 | $servers = [ |
| 138 | - [ |
|
| 138 | + [ |
|
| 139 | 139 | 'host' => '127.0.0.1', |
| 140 | 140 | 'path' => false, |
| 141 | 141 | 'port' => 11211, |
| 142 | 142 | 'sasl_user' => false, |
| 143 | 143 | 'sasl_password' => false, |
| 144 | - ], |
|
| 144 | + ], |
|
| 145 | 145 | ]; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -184,9 +184,9 @@ discard block |
||
| 184 | 184 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
| 185 | 185 | |
| 186 | 186 | return (new DriverStatistic()) |
| 187 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 188 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 189 | - ->setRawData($stats) |
|
| 190 | - ->setSize($stats[ 'bytes' ]); |
|
| 187 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 188 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 189 | + ->setRawData($stats) |
|
| 190 | + ->setSize($stats[ 'bytes' ]); |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | \ No newline at end of file |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | */ |
| 153 | 153 | if(!empty($server[ 'path' ]) && !$this->instance->addServer($server[ 'path' ], 0)){ |
| 154 | 154 | $this->fallback = true; |
| 155 | - }else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 155 | + } else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 156 | 156 | $this->fallback = true; |
| 157 | 157 | } |
| 158 | 158 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | } else { |
| 54 | 54 | $this->driverConnect(); |
| 55 | 55 | |
| 56 | - if (array_key_exists('compress_data', $config) && $config[ 'compress_data' ] === true) { |
|
| 56 | + if (array_key_exists('compress_data', $config) && $config['compress_data'] === true) { |
|
| 57 | 57 | $this->memcacheFlags = MEMCACHE_COMPRESSED; |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | protected function driverConnect() |
| 139 | 139 | { |
| 140 | 140 | $this->instance = new MemcacheSoftware(); |
| 141 | - $servers = (!empty($this->config[ 'servers' ]) && is_array($this->config[ 'servers' ]) ? $this->config[ 'servers' ] : []); |
|
| 141 | + $servers = (!empty($this->config['servers']) && is_array($this->config['servers']) ? $this->config['servers'] : []); |
|
| 142 | 142 | if (count($servers) < 1) { |
| 143 | 143 | $servers = [ |
| 144 | 144 | [ |
@@ -156,13 +156,13 @@ discard block |
||
| 156 | 156 | /** |
| 157 | 157 | * If path is provided we consider it as an UNIX Socket |
| 158 | 158 | */ |
| 159 | - if(!empty($server[ 'path' ]) && !$this->instance->addServer($server[ 'path' ], 0)){ |
|
| 159 | + if (!empty($server['path']) && !$this->instance->addServer($server['path'], 0)) { |
|
| 160 | 160 | $this->fallback = true; |
| 161 | - }else if (!empty($server[ 'host' ]) && !$this->instance->addServer($server[ 'host' ], $server[ 'port' ])) { |
|
| 161 | + } else if (!empty($server['host']) && !$this->instance->addServer($server['host'], $server['port'])) { |
|
| 162 | 162 | $this->fallback = true; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if (!empty($server[ 'sasl_user' ]) && !empty($server[ 'sasl_password' ])) { |
|
| 165 | + if (!empty($server['sasl_user']) && !empty($server['sasl_password'])) { |
|
| 166 | 166 | throw new phpFastCacheDriverException('Unlike Memcached, Memcache does not support SASL authentication'); |
| 167 | 167 | } |
| 168 | 168 | } catch (\Exception $e) { |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * Since Memcached does not throw |
| 175 | 175 | * any error if not connected ... |
| 176 | 176 | */ |
| 177 | - if(!$this->instance->getServerStatus()){ |
|
| 177 | + if (!$this->instance->getServerStatus()) { |
|
| 178 | 178 | throw new phpFastCacheDriverException('Memcache seems to not be connected'); |
| 179 | 179 | } |
| 180 | 180 | return true; |
@@ -191,17 +191,17 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function getStats() |
| 193 | 193 | { |
| 194 | - $stats = (array)$this->instance->getstats(); |
|
| 195 | - $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
| 196 | - $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion'); |
|
| 197 | - $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
| 194 | + $stats = (array) $this->instance->getstats(); |
|
| 195 | + $stats['uptime'] = (isset($stats['uptime']) ? $stats['uptime'] : 0); |
|
| 196 | + $stats['version'] = (isset($stats['version']) ? $stats['version'] : 'UnknownVersion'); |
|
| 197 | + $stats['bytes'] = (isset($stats['bytes']) ? $stats['version'] : 0); |
|
| 198 | 198 | |
| 199 | - $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
| 199 | + $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']); |
|
| 200 | 200 | |
| 201 | 201 | return (new DriverStatistic()) |
| 202 | 202 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 203 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 203 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
| 204 | 204 | ->setRawData($stats) |
| 205 | - ->setSize($stats[ 'bytes' ]); |
|
| 205 | + ->setSize($stats['bytes']); |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | \ No newline at end of file |