@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | * In case of an user-provided |
65 | 65 | * Predis client just return here |
66 | 66 | */ |
67 | - if($this->getConfig()->getPredisClient() instanceof PredisClient){ |
|
67 | + if ($this->getConfig()->getPredisClient() instanceof PredisClient) { |
|
68 | 68 | $this->instance = $this->getConfig()->getPredisClient(); |
69 | - if(!$this->instance->isConnected()){ |
|
69 | + if (!$this->instance->isConnected()) { |
|
70 | 70 | $this->instance->connect(); |
71 | 71 | } |
72 | 72 | return true; |
73 | 73 | } |
74 | 74 | |
75 | - if(!empty($this->getConfig()->getPath())){ |
|
75 | + if (!empty($this->getConfig()->getPath())) { |
|
76 | 76 | $this->instance = new PredisClient([ |
77 | 77 | 'scheme' => 'unix', |
78 | 78 | 'path' => $this->getConfig()->getPath() |
79 | 79 | ]); |
80 | - }else{ |
|
80 | + } else { |
|
81 | 81 | $this->instance = new PredisClient($this->getConfig()->getPredisConfigArray()); |
82 | 82 | } |
83 | 83 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @see https://redis.io/commands/expire |
124 | 124 | */ |
125 | 125 | if ($ttl <= 0) { |
126 | - return (bool)$this->instance->expire($item->getKey(), 0); |
|
126 | + return (bool) $this->instance->expire($item->getKey(), 0); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item)))->getPayload() === 'OK'; |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | public function getStats(): DriverStatistic |
184 | 184 | { |
185 | 185 | $info = $this->instance->info(); |
186 | - $size = (isset($info[ 'Memory' ][ 'used_memory' ]) ? $info[ 'Memory' ][ 'used_memory' ] : 0); |
|
187 | - $version = (isset($info[ 'Server' ][ 'redis_version' ]) ? $info[ 'Server' ][ 'redis_version' ] : 0); |
|
188 | - $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(\time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
|
186 | + $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0); |
|
187 | + $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0); |
|
188 | + $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(\time() - $info['Server']['uptime_in_seconds']) : 'unknown date'); |
|
189 | 189 | |
190 | 190 | return (new DriverStatistic()) |
191 | 191 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * In case of an user-provided |
60 | 60 | * Redis client just return here |
61 | 61 | */ |
62 | - if($this->getConfig()->getRedisClient() instanceof RedisClient){ |
|
62 | + if ($this->getConfig()->getRedisClient() instanceof RedisClient) { |
|
63 | 63 | /** |
64 | 64 | * Unlike Predis, we can't test if we're are connected |
65 | 65 | * or not, so let's just assume that we are |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * Check for Cross-Driver type confusion |
148 | 148 | */ |
149 | 149 | if ($item instanceof Item) { |
150 | - return (bool)$this->instance->del($item->getKey()); |
|
150 | + return (bool) $this->instance->del($item->getKey()); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | { |
175 | 175 | // used_memory |
176 | 176 | $info = $this->instance->info(); |
177 | - $date = (new \DateTime())->setTimestamp(\time() - $info[ 'uptime_in_seconds' ]); |
|
177 | + $date = (new \DateTime())->setTimestamp(\time() - $info['uptime_in_seconds']); |
|
178 | 178 | |
179 | 179 | return (new DriverStatistic()) |
180 | 180 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
181 | 181 | ->setRawData($info) |
182 | - ->setSize((int)$info[ 'used_memory' ]) |
|
182 | + ->setSize((int) $info['used_memory']) |
|
183 | 183 | ->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.", |
184 | - $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
184 | + $info['redis_version'], $date->format(DATE_RFC2822))); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | \ No newline at end of file |