@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
| 20 | 20 | use Phpfastcache\Entities\DriverStatistic; |
| 21 | 21 | use Phpfastcache\Exceptions\{ |
| 22 | - phpFastCacheInvalidArgumentException, phpFastCacheDriverException |
|
| 22 | + phpFastCacheInvalidArgumentException, phpFastCacheDriverException |
|
| 23 | 23 | }; |
| 24 | 24 | use Phpfastcache\Util\ArrayObject; |
| 25 | 25 | use Predis\Client as PredisClient; |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | if(!empty($this->config->getOption('path'))){ |
| 59 | 59 | $this->instance = new PredisClient([ |
| 60 | - 'scheme' => 'unix', |
|
| 61 | - 'path' => $this->config->getOption('path') |
|
| 60 | + 'scheme' => 'unix', |
|
| 61 | + 'path' => $this->config->getOption('path') |
|
| 62 | 62 | ]); |
| 63 | 63 | }else{ |
| 64 | 64 | $this->instance = new PredisClient($this->getConfig()->getPredisConfigArray()); |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 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 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 175 | - ->setRawData($info) |
|
| 176 | - ->setSize((int) $size) |
|
| 177 | - ->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.", |
|
| 174 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 175 | + ->setRawData($info) |
|
| 176 | + ->setSize((int) $size) |
|
| 177 | + ->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.", |
|
| 178 | 178 | $version, $date->format(DATE_RFC2822))); |
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | \ No newline at end of file |
@@ -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))) |
@@ -60,7 +60,7 @@ |
||
| 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 | |