@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @author Georges.L (Geolim4) <[email protected]> |
| 13 | 13 | * |
| 14 | 14 | */ |
| 15 | -declare(strict_types=1); |
|
| 15 | +declare(strict_types = 1); |
|
| 16 | 16 | |
| 17 | 17 | namespace Phpfastcache\Drivers\Predis; |
| 18 | 18 | |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | protected function driverConnect(): bool |
| 57 | 57 | { |
| 58 | - if(!empty($this->config->getOption('path'))){ |
|
| 58 | + if (!empty($this->config->getOption('path'))) { |
|
| 59 | 59 | $this->instance = new PredisClient([ |
| 60 | 60 | 'scheme' => 'unix', |
| 61 | 61 | 'path' => $this->config->getOption('path') |
| 62 | 62 | ]); |
| 63 | - }else{ |
|
| 63 | + } else { |
|
| 64 | 64 | $this->instance = new PredisClient($this->getConfig()->getPredisConfigArray()); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @see https://redis.io/commands/expire |
| 107 | 107 | */ |
| 108 | 108 | if ($ttl <= 0) { |
| 109 | - return (bool)$this->instance->expire($item->getKey(), 0); |
|
| 109 | + return (bool) $this->instance->expire($item->getKey(), 0); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item)))->getPayload() === 'OK'; |
@@ -166,9 +166,9 @@ discard block |
||
| 166 | 166 | public function getStats(): DriverStatistic |
| 167 | 167 | { |
| 168 | 168 | $info = $this->instance->info(); |
| 169 | - $size = (isset($info[ 'Memory' ][ 'used_memory' ]) ? $info[ 'Memory' ][ 'used_memory' ] : 0); |
|
| 170 | - $version = (isset($info[ 'Server' ][ 'redis_version' ]) ? $info[ 'Server' ][ 'redis_version' ] : 0); |
|
| 171 | - $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
|
| 169 | + $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0); |
|
| 170 | + $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0); |
|
| 171 | + $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date'); |
|
| 172 | 172 | |
| 173 | 173 | return (new DriverStatistic()) |
| 174 | 174 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |