@@ -42,7 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @param \Psr\Cache\CacheItemInterface $item |
| 45 | - * @return mixed |
|
| 45 | + * @return boolean |
|
| 46 | 46 | * @throws phpFastCacheInvalidArgumentException |
| 47 | 47 | */ |
| 48 | 48 | protected function driverWrite(CacheItemInterface $item): bool |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
| 19 | 19 | use Phpfastcache\Entities\DriverStatistic; |
| 20 | 20 | use Phpfastcache\Exceptions\{ |
| 21 | - phpFastCacheInvalidArgumentException |
|
| 21 | + phpFastCacheInvalidArgumentException |
|
| 22 | 22 | }; |
| 23 | 23 | use Psr\Cache\CacheItemInterface; |
| 24 | 24 | |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | protected function driverRead(CacheItemInterface $item): array |
| 65 | 65 | { |
| 66 | 66 | return [ |
| 67 | - self::DRIVER_DATA_WRAPPER_INDEX => true, |
|
| 68 | - self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
| 69 | - self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
| 67 | + self::DRIVER_DATA_WRAPPER_INDEX => true, |
|
| 68 | + self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
| 69 | + self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
| 70 | 70 | ]; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | { |
| 117 | 117 | $stat = new DriverStatistic(); |
| 118 | 118 | $stat->setInfo('[Devtrue] A void info string') |
| 119 | - ->setSize(0) |
|
| 120 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 121 | - ->setRawData(true); |
|
| 119 | + ->setSize(0) |
|
| 120 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 121 | + ->setRawData(true); |
|
| 122 | 122 | |
| 123 | 123 | return $stat; |
| 124 | 124 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -declare(strict_types=1); |
|
| 14 | +declare(strict_types = 1); |
|
| 15 | 15 | |
| 16 | 16 | namespace Phpfastcache\Drivers\Devtrue; |
| 17 | 17 | |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * @param \Psr\Cache\CacheItemInterface $item |
| 79 | - * @return mixed |
|
| 79 | + * @return boolean |
|
| 80 | 80 | * @throws phpFastCacheInvalidArgumentException |
| 81 | 81 | * @throws phpFastCacheDriverException |
| 82 | 82 | */ |
@@ -27,7 +27,6 @@ |
||
| 27 | 27 | use Phpfastcache\Exceptions\{ |
| 28 | 28 | phpFastCacheDriverException, phpFastCacheInvalidArgumentException |
| 29 | 29 | }; |
| 30 | -use Phpfastcache\Util\ArrayObject; |
|
| 31 | 30 | use Psr\Cache\CacheItemInterface; |
| 32 | 31 | |
| 33 | 32 | /** |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | use LogicException; |
| 20 | 20 | use MongoDB\{ |
| 21 | - BSON\Binary, BSON\UTCDateTime, Collection, DeleteResult, Driver\Command, Driver\Exception\Exception as MongoDBException, Driver\Manager as MongodbManager |
|
| 21 | + BSON\Binary, BSON\UTCDateTime, Collection, DeleteResult, Driver\Command, Driver\Exception\Exception as MongoDBException, Driver\Manager as MongodbManager |
|
| 22 | 22 | }; |
| 23 | 23 | use Phpfastcache\Core\Pool\{ |
| 24 | - DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
| 24 | + DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
| 25 | 25 | }; |
| 26 | 26 | use Phpfastcache\Entities\DriverStatistic; |
| 27 | 27 | use Phpfastcache\Exceptions\{ |
| 28 | - phpFastCacheDriverException, phpFastCacheInvalidArgumentException |
|
| 28 | + phpFastCacheDriverException, phpFastCacheInvalidArgumentException |
|
| 29 | 29 | }; |
| 30 | 30 | use Phpfastcache\Util\ArrayObject; |
| 31 | 31 | use Psr\Cache\CacheItemInterface; |
@@ -71,16 +71,16 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | if ($document) { |
| 73 | 73 | $return = [ |
| 74 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()), |
|
| 75 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()), |
|
| 76 | - self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()), |
|
| 74 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()), |
|
| 75 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()), |
|
| 76 | + self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()), |
|
| 77 | 77 | ]; |
| 78 | 78 | |
| 79 | 79 | if(!empty($this->getConfigOption('itemDetailedDate'))){ |
| 80 | 80 | $return += [ |
| 81 | - self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_MDATE_WRAPPER_INDEX ]->toDateTime() |
|
| 81 | + self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_MDATE_WRAPPER_INDEX ]->toDateTime() |
|
| 82 | 82 | ->getTimestamp()), |
| 83 | - self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_CDATE_WRAPPER_INDEX ]->toDateTime() |
|
| 83 | + self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_CDATE_WRAPPER_INDEX ]->toDateTime() |
|
| 84 | 84 | ->getTimestamp()), |
| 85 | 85 | ]; |
| 86 | 86 | } |
@@ -105,23 +105,23 @@ discard block |
||
| 105 | 105 | if ($item instanceof Item) { |
| 106 | 106 | try { |
| 107 | 107 | $set = [ |
| 108 | - self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC), |
|
| 109 | - self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC), |
|
| 110 | - self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time() * 1000)), |
|
| 108 | + self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC), |
|
| 109 | + self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC), |
|
| 110 | + self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time() * 1000)), |
|
| 111 | 111 | ]; |
| 112 | 112 | |
| 113 | 113 | if(!empty($this->getConfigOption('itemDetailedDate'))){ |
| 114 | 114 | $set += [ |
| 115 | - self::DRIVER_MDATE_WRAPPER_INDEX => ($item->getModificationDate() ? new UTCDateTime(($item->getModificationDate()->getTimestamp()) * 1000) : new UTCDateTime(time() * 1000)), |
|
| 116 | - self::DRIVER_CDATE_WRAPPER_INDEX => ($item->getCreationDate() ? new UTCDateTime(($item->getCreationDate()->getTimestamp()) * 1000) : new UTCDateTime(time() * 1000)), |
|
| 115 | + self::DRIVER_MDATE_WRAPPER_INDEX => ($item->getModificationDate() ? new UTCDateTime(($item->getModificationDate()->getTimestamp()) * 1000) : new UTCDateTime(time() * 1000)), |
|
| 116 | + self::DRIVER_CDATE_WRAPPER_INDEX => ($item->getCreationDate() ? new UTCDateTime(($item->getCreationDate()->getTimestamp()) * 1000) : new UTCDateTime(time() * 1000)), |
|
| 117 | 117 | ]; |
| 118 | 118 | } |
| 119 | 119 | $result = (array)$this->getCollection()->updateOne( |
| 120 | - ['_id' => $item->getEncodedKey()], |
|
| 121 | - [ |
|
| 120 | + ['_id' => $item->getEncodedKey()], |
|
| 121 | + [ |
|
| 122 | 122 | '$set' => $set, |
| 123 | - ], |
|
| 124 | - ['upsert' => true, 'multiple' => false] |
|
| 123 | + ], |
|
| 124 | + ['upsert' => true, 'multiple' => false] |
|
| 125 | 125 | ); |
| 126 | 126 | } catch (MongoDBException $e) { |
| 127 | 127 | throw new phpFastCacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e); |
@@ -191,10 +191,10 @@ discard block |
||
| 191 | 191 | * @todo make an url builder |
| 192 | 192 | */ |
| 193 | 193 | $this->instance = $this->instance ?: (new MongodbManager('mongodb://' . |
| 194 | - ($clientConfig[ 'username' ] ?: '') . |
|
| 195 | - ($clientConfig[ 'password' ] ? ":{$clientConfig['password']}" : '') . |
|
| 196 | - ($clientConfig[ 'username' ] ? '@' : '') . "{$clientConfig['host']}" . |
|
| 197 | - ($clientConfig[ 'port' ] != 27017 ? ":{$clientConfig['port']}" : ''), ['connectTimeoutMS' => $clientConfig[ 'timeout' ] * 1000])); |
|
| 194 | + ($clientConfig[ 'username' ] ?: '') . |
|
| 195 | + ($clientConfig[ 'password' ] ? ":{$clientConfig['password']}" : '') . |
|
| 196 | + ($clientConfig[ 'username' ] ? '@' : '') . "{$clientConfig['host']}" . |
|
| 197 | + ($clientConfig[ 'port' ] != 27017 ? ":{$clientConfig['port']}" : ''), ['connectTimeoutMS' => $clientConfig[ 'timeout' ] * 1000])); |
|
| 198 | 198 | $this->collection = $this->collection ?: new Collection($this->instance, $clientConfig[ 'databaseName' ], $clientConfig[ 'collectionName' ]); |
| 199 | 199 | |
| 200 | 200 | return true; |
@@ -221,15 +221,15 @@ discard block |
||
| 221 | 221 | public function getStats(): DriverStatistic |
| 222 | 222 | { |
| 223 | 223 | $serverStats = $this->instance->executeCommand($this->getConfigOption('databaseName'), new Command([ |
| 224 | - 'serverStatus' => 1, |
|
| 225 | - 'recordStats' => 0, |
|
| 226 | - 'repl' => 0, |
|
| 227 | - 'metrics' => 0, |
|
| 224 | + 'serverStatus' => 1, |
|
| 225 | + 'recordStats' => 0, |
|
| 226 | + 'repl' => 0, |
|
| 227 | + 'metrics' => 0, |
|
| 228 | 228 | ]))->toArray()[ 0 ]; |
| 229 | 229 | |
| 230 | 230 | $collectionStats = $this->instance->executeCommand($this->getConfigOption('databaseName'), new Command([ |
| 231 | - 'collStats' => ($this->config->getOption('collectionName') !== null ? $this->config->getOption('collectionName') : 'Cache'), |
|
| 232 | - 'verbose' => true, |
|
| 231 | + 'collStats' => ($this->config->getOption('collectionName') !== null ? $this->config->getOption('collectionName') : 'Cache'), |
|
| 232 | + 'verbose' => true, |
|
| 233 | 233 | ]))->toArray()[ 0 ]; |
| 234 | 234 | |
| 235 | 235 | $array_filter_recursive = function ($array, callable $callback = null) use (&$array_filter_recursive) { |
@@ -258,14 +258,14 @@ discard block |
||
| 258 | 258 | $collectionStats = $array_filter_recursive($collectionStats, $callback); |
| 259 | 259 | |
| 260 | 260 | $stats = (new DriverStatistic()) |
| 261 | - ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . round($serverStats->uptime / 86400, |
|
| 262 | - 1) . "\n For more information see RawData.") |
|
| 263 | - ->setSize($collectionStats->size) |
|
| 264 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 265 | - ->setRawData([ |
|
| 261 | + ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . round($serverStats->uptime / 86400, |
|
| 262 | + 1) . "\n For more information see RawData.") |
|
| 263 | + ->setSize($collectionStats->size) |
|
| 264 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 265 | + ->setRawData([ |
|
| 266 | 266 | 'serverStatus' => $serverStats, |
| 267 | 267 | 'collStats' => $collectionStats, |
| 268 | - ]); |
|
| 268 | + ]); |
|
| 269 | 269 | |
| 270 | 270 | return $stats; |
| 271 | 271 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @author Fabio Covolo Mazzo (fabiocmazzo) <[email protected]> |
| 13 | 13 | * |
| 14 | 14 | */ |
| 15 | -declare(strict_types=1); |
|
| 15 | +declare(strict_types = 1); |
|
| 16 | 16 | |
| 17 | 17 | namespace Phpfastcache\Drivers\Mongodb; |
| 18 | 18 | |
@@ -71,16 +71,16 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | if ($document) { |
| 73 | 73 | $return = [ |
| 74 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()), |
|
| 75 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()), |
|
| 76 | - self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()), |
|
| 74 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->getData()), |
|
| 75 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->getData()), |
|
| 76 | + self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_EDATE_WRAPPER_INDEX]->toDateTime()->getTimestamp()), |
|
| 77 | 77 | ]; |
| 78 | 78 | |
| 79 | - if(!empty($this->getConfigOption('itemDetailedDate'))){ |
|
| 79 | + if (!empty($this->getConfigOption('itemDetailedDate'))) { |
|
| 80 | 80 | $return += [ |
| 81 | - self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_MDATE_WRAPPER_INDEX ]->toDateTime() |
|
| 81 | + self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_MDATE_WRAPPER_INDEX]->toDateTime() |
|
| 82 | 82 | ->getTimestamp()), |
| 83 | - self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_CDATE_WRAPPER_INDEX ]->toDateTime() |
|
| 83 | + self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_CDATE_WRAPPER_INDEX]->toDateTime() |
|
| 84 | 84 | ->getTimestamp()), |
| 85 | 85 | ]; |
| 86 | 86 | } |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((time() + $item->getTtl()) * 1000) : new UTCDateTime(time() * 1000)), |
| 111 | 111 | ]; |
| 112 | 112 | |
| 113 | - if(!empty($this->getConfigOption('itemDetailedDate'))){ |
|
| 113 | + if (!empty($this->getConfigOption('itemDetailedDate'))) { |
|
| 114 | 114 | $set += [ |
| 115 | 115 | self::DRIVER_MDATE_WRAPPER_INDEX => ($item->getModificationDate() ? new UTCDateTime(($item->getModificationDate()->getTimestamp()) * 1000) : new UTCDateTime(time() * 1000)), |
| 116 | 116 | self::DRIVER_CDATE_WRAPPER_INDEX => ($item->getCreationDate() ? new UTCDateTime(($item->getCreationDate()->getTimestamp()) * 1000) : new UTCDateTime(time() * 1000)), |
| 117 | 117 | ]; |
| 118 | 118 | } |
| 119 | - $result = (array)$this->getCollection()->updateOne( |
|
| 119 | + $result = (array) $this->getCollection()->updateOne( |
|
| 120 | 120 | ['_id' => $item->getEncodedKey()], |
| 121 | 121 | [ |
| 122 | 122 | '$set' => $set, |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | throw new phpFastCacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true; |
|
| 130 | + return isset($result['ok']) ? $result['ok'] == 1 : true; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | throw new phpFastCacheInvalidArgumentException('Cross-Driver type confusion detected'); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | $this->save($this->getItem('__PFC_CACHE_CLEARED__')->set(true)); |
| 173 | 173 | |
| 174 | - return !empty($result[ 'ok' ]); |
|
| 174 | + return !empty($result['ok']); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | * @todo make an url builder |
| 192 | 192 | */ |
| 193 | 193 | $this->instance = $this->instance ?: (new MongodbManager('mongodb://' . |
| 194 | - ($clientConfig[ 'username' ] ?: '') . |
|
| 195 | - ($clientConfig[ 'password' ] ? ":{$clientConfig['password']}" : '') . |
|
| 196 | - ($clientConfig[ 'username' ] ? '@' : '') . "{$clientConfig['host']}" . |
|
| 197 | - ($clientConfig[ 'port' ] != 27017 ? ":{$clientConfig['port']}" : ''), ['connectTimeoutMS' => $clientConfig[ 'timeout' ] * 1000])); |
|
| 198 | - $this->collection = $this->collection ?: new Collection($this->instance, $clientConfig[ 'databaseName' ], $clientConfig[ 'collectionName' ]); |
|
| 194 | + ($clientConfig['username'] ?: '') . |
|
| 195 | + ($clientConfig['password'] ? ":{$clientConfig['password']}" : '') . |
|
| 196 | + ($clientConfig['username'] ? '@' : '') . "{$clientConfig['host']}" . |
|
| 197 | + ($clientConfig['port'] != 27017 ? ":{$clientConfig['port']}" : ''), ['connectTimeoutMS' => $clientConfig['timeout'] * 1000])); |
|
| 198 | + $this->collection = $this->collection ?: new Collection($this->instance, $clientConfig['databaseName'], $clientConfig['collectionName']); |
|
| 199 | 199 | |
| 200 | 200 | return true; |
| 201 | 201 | } |
@@ -225,14 +225,14 @@ discard block |
||
| 225 | 225 | 'recordStats' => 0, |
| 226 | 226 | 'repl' => 0, |
| 227 | 227 | 'metrics' => 0, |
| 228 | - ]))->toArray()[ 0 ]; |
|
| 228 | + ]))->toArray()[0]; |
|
| 229 | 229 | |
| 230 | 230 | $collectionStats = $this->instance->executeCommand($this->getConfigOption('databaseName'), new Command([ |
| 231 | 231 | 'collStats' => ($this->config->getOption('collectionName') !== null ? $this->config->getOption('collectionName') : 'Cache'), |
| 232 | 232 | 'verbose' => true, |
| 233 | - ]))->toArray()[ 0 ]; |
|
| 233 | + ]))->toArray()[0]; |
|
| 234 | 234 | |
| 235 | - $array_filter_recursive = function ($array, callable $callback = null) use (&$array_filter_recursive) { |
|
| 235 | + $array_filter_recursive = function($array, callable $callback = null) use (&$array_filter_recursive) { |
|
| 236 | 236 | $array = $callback($array); |
| 237 | 237 | |
| 238 | 238 | if (\is_object($array) || \is_array($array)) { |
@@ -244,12 +244,12 @@ discard block |
||
| 244 | 244 | return $array; |
| 245 | 245 | }; |
| 246 | 246 | |
| 247 | - $callback = function ($item) { |
|
| 247 | + $callback = function($item) { |
|
| 248 | 248 | /** |
| 249 | 249 | * Remove unserializable properties |
| 250 | 250 | */ |
| 251 | 251 | if ($item instanceof \MongoDB\BSON\UTCDateTime) { |
| 252 | - return (string)$item; |
|
| 252 | + return (string) $item; |
|
| 253 | 253 | } |
| 254 | 254 | return $item; |
| 255 | 255 | }; |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * @param \Psr\Cache\CacheItemInterface $item |
| 94 | - * @return mixed |
|
| 94 | + * @return boolean |
|
| 95 | 95 | * @throws phpFastCacheInvalidArgumentException |
| 96 | 96 | */ |
| 97 | 97 | protected function driverWrite(CacheItemInterface $item): bool |
@@ -21,7 +21,6 @@ |
||
| 21 | 21 | use Phpfastcache\Exceptions\{ |
| 22 | 22 | phpFastCacheInvalidArgumentException, phpFastCacheDriverException |
| 23 | 23 | }; |
| 24 | -use Phpfastcache\Util\ArrayObject; |
|
| 25 | 24 | use Predis\Client as PredisClient; |
| 26 | 25 | use Predis\Connection\ConnectionException as PredisConnectionException; |
| 27 | 26 | use Psr\Cache\CacheItemInterface; |
@@ -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 | var_dump($this->getConfig()->getPredisConfigArray()); |
@@ -172,10 +172,10 @@ discard block |
||
| 172 | 172 | $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
| 173 | 173 | |
| 174 | 174 | return (new DriverStatistic()) |
| 175 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 176 | - ->setRawData($info) |
|
| 177 | - ->setSize((int) $size) |
|
| 178 | - ->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.", |
|
| 175 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 176 | + ->setRawData($info) |
|
| 177 | + ->setSize((int) $size) |
|
| 178 | + ->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.", |
|
| 179 | 179 | $version, $date->format(DATE_RFC2822))); |
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | \ 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 | var_dump($this->getConfig()->getPredisConfigArray()); |
| 65 | 65 | $this->instance = new PredisClient($this->getConfig()->getPredisConfigArray()); |
| 66 | 66 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @see https://redis.io/commands/expire |
| 108 | 108 | */ |
| 109 | 109 | if ($ttl <= 0) { |
| 110 | - return (bool)$this->instance->expire($item->getKey(), 0); |
|
| 110 | + return (bool) $this->instance->expire($item->getKey(), 0); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | return $this->instance->setex($item->getKey(), $ttl, $this->encode($this->driverPreWrap($item)))->getPayload() === 'OK'; |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | public function getStats(): DriverStatistic |
| 168 | 168 | { |
| 169 | 169 | $info = $this->instance->info(); |
| 170 | - $size = (isset($info[ 'Memory' ][ 'used_memory' ]) ? $info[ 'Memory' ][ 'used_memory' ] : 0); |
|
| 171 | - $version = (isset($info[ 'Server' ][ 'redis_version' ]) ? $info[ 'Server' ][ 'redis_version' ] : 0); |
|
| 172 | - $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
|
| 170 | + $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0); |
|
| 171 | + $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0); |
|
| 172 | + $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date'); |
|
| 173 | 173 | |
| 174 | 174 | return (new DriverStatistic()) |
| 175 | 175 | ->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 | var_dump($this->getConfig()->getPredisConfigArray()); |
| 65 | 65 | $this->instance = new PredisClient($this->getConfig()->getPredisConfigArray()); |
| 66 | 66 | } |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * @param \Psr\Cache\CacheItemInterface $item |
| 82 | - * @return mixed |
|
| 82 | + * @return boolean |
|
| 83 | 83 | * @throws phpFastCacheInvalidArgumentException |
| 84 | 84 | */ |
| 85 | 85 | protected function driverWrite(CacheItemInterface $item): bool |
@@ -21,7 +21,6 @@ |
||
| 21 | 21 | use Phpfastcache\Exceptions\{ |
| 22 | 22 | phpFastCacheInvalidArgumentException, phpFastCacheLogicException |
| 23 | 23 | }; |
| 24 | -use Phpfastcache\Util\ArrayObject; |
|
| 25 | 24 | use Psr\Cache\CacheItemInterface; |
| 26 | 25 | |
| 27 | 26 | /** |
@@ -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, phpFastCacheLogicException |
|
| 22 | + phpFastCacheInvalidArgumentException, phpFastCacheLogicException |
|
| 23 | 23 | }; |
| 24 | 24 | use Phpfastcache\Util\ArrayObject; |
| 25 | 25 | use Psr\Cache\CacheItemInterface; |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | if ($item instanceof Item) { |
| 91 | 91 | $this->instance |
| 92 | - ->bucket($this->bucketName) |
|
| 93 | - ->newBinary($item->getKey(), $this->encode($this->driverPreWrap($item))) |
|
| 94 | - ->store(); |
|
| 92 | + ->bucket($this->bucketName) |
|
| 93 | + ->newBinary($item->getKey(), $this->encode($this->driverPreWrap($item))) |
|
| 94 | + ->store(); |
|
| 95 | 95 | return true; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | $info = $this->instance->bucket($this->bucketName)->getProperties(); |
| 143 | 143 | |
| 144 | 144 | return (new DriverStatistic()) |
| 145 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 146 | - ->setRawData($info) |
|
| 147 | - ->setSize(false) |
|
| 148 | - ->setInfo('Riak does not provide size/date information att all :('); |
|
| 145 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 146 | + ->setRawData($info) |
|
| 147 | + ->setSize(false) |
|
| 148 | + ->setInfo('Riak does not provide size/date information att all :('); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | \ No newline at end of file |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -declare(strict_types=1); |
|
| 14 | +declare(strict_types = 1); |
|
| 15 | 15 | |
| 16 | 16 | namespace Phpfastcache\Drivers\Riak; |
| 17 | 17 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | 138 | * @param \Psr\Cache\CacheItemInterface $item |
| 139 | - * @return mixed |
|
| 139 | + * @return boolean |
|
| 140 | 140 | * @throws phpFastCacheInvalidArgumentException |
| 141 | 141 | */ |
| 142 | 142 | protected function driverWrite(CacheItemInterface $item): bool |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
| 348 | - * @param $keyword |
|
| 348 | + * @param string $keyword |
|
| 349 | 349 | * @param bool $reset |
| 350 | 350 | * @return PDO |
| 351 | 351 | */ |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | use PDOException; |
| 20 | 20 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface, IO\IOHelperTrait}; |
| 21 | 21 | use Phpfastcache\Exceptions\{ |
| 22 | - phpFastCacheInvalidArgumentException, phpFastCacheIOException |
|
| 22 | + phpFastCacheInvalidArgumentException, phpFastCacheIOException |
|
| 23 | 23 | }; |
| 24 | 24 | use Psr\Cache\CacheItemInterface; |
| 25 | 25 | |
@@ -108,18 +108,18 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | try { |
| 110 | 110 | $stm = $this->getDb($item->getKey()) |
| 111 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
|
| 111 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
|
| 112 | 112 | $stm->execute([ |
| 113 | - ':keyword' => $item->getKey(), |
|
| 113 | + ':keyword' => $item->getKey(), |
|
| 114 | 114 | ]); |
| 115 | 115 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 116 | 116 | |
| 117 | 117 | } catch (PDOException $e) { |
| 118 | 118 | try { |
| 119 | 119 | $stm = $this->getDb($item->getKey(), true) |
| 120 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
|
| 120 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword LIMIT 1"); |
|
| 121 | 121 | $stm->execute([ |
| 122 | - ':keyword' => $item->getKey(), |
|
| 122 | + ':keyword' => $item->getKey(), |
|
| 123 | 123 | ]); |
| 124 | 124 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 125 | 125 | } catch (PDOException $e) { |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | if ($toWrite == true) { |
| 163 | 163 | try { |
| 164 | 164 | $stm = $this->getDb($item->getKey()) |
| 165 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 165 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 166 | 166 | $stm->execute([ |
| 167 | - ':keyword' => $item->getKey(), |
|
| 168 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 169 | - ':exp' => $item->getExpirationDate()->getTimestamp(), |
|
| 167 | + ':keyword' => $item->getKey(), |
|
| 168 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 169 | + ':exp' => $item->getExpirationDate()->getTimestamp(), |
|
| 170 | 170 | ]); |
| 171 | 171 | |
| 172 | 172 | return true; |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | try { |
| 176 | 176 | $stm = $this->getDb($item->getKey(), true) |
| 177 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 177 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 178 | 178 | $stm->execute([ |
| 179 | - ':keyword' => $item->getKey(), |
|
| 180 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 181 | - ':exp' => $item->getExpirationDate()->getTimestamp(), |
|
| 179 | + ':keyword' => $item->getKey(), |
|
| 180 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 181 | + ':exp' => $item->getExpirationDate()->getTimestamp(), |
|
| 182 | 182 | ]); |
| 183 | 183 | } catch (PDOException $e) { |
| 184 | 184 | return false; |
@@ -205,11 +205,11 @@ discard block |
||
| 205 | 205 | if ($item instanceof Item) { |
| 206 | 206 | try { |
| 207 | 207 | $stm = $this->getDb($item->getKey()) |
| 208 | - ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
| 208 | + ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
| 209 | 209 | |
| 210 | 210 | return $stm->execute([ |
| 211 | - ':keyword' => $item->getKey(), |
|
| 212 | - ':U' => time(), |
|
| 211 | + ':keyword' => $item->getKey(), |
|
| 212 | + ':U' => time(), |
|
| 213 | 213 | ]); |
| 214 | 214 | } catch (PDOException $e) { |
| 215 | 215 | return false; |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | $PDO = new PDO("sqlite:" . $this->SqliteDir . '/' . self::INDEXING_FILE); |
| 291 | 291 | $PDO->setAttribute(PDO::ATTR_ERRMODE, |
| 292 | - PDO::ERRMODE_EXCEPTION); |
|
| 292 | + PDO::ERRMODE_EXCEPTION); |
|
| 293 | 293 | |
| 294 | 294 | if ($createTable == true) { |
| 295 | 295 | $this->initIndexing($PDO); |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | // look for keyword |
| 325 | 325 | $stm = $this->indexing->prepare("SELECT * FROM `balancing` WHERE `keyword`=:keyword LIMIT 1"); |
| 326 | 326 | $stm->execute([ |
| 327 | - ':keyword' => $keyword, |
|
| 327 | + ':keyword' => $keyword, |
|
| 328 | 328 | ]); |
| 329 | 329 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 330 | 330 | if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
@@ -336,8 +336,8 @@ discard block |
||
| 336 | 336 | $db = $this->currentDB; |
| 337 | 337 | $stm = $this->indexing->prepare("INSERT INTO `balancing` (`keyword`,`db`) VALUES(:keyword, :db)"); |
| 338 | 338 | $stm->execute([ |
| 339 | - ':keyword' => $keyword, |
|
| 340 | - ':db' => $db, |
|
| 339 | + ':keyword' => $keyword, |
|
| 340 | + ':db' => $db, |
|
| 341 | 341 | ]); |
| 342 | 342 | } |
| 343 | 343 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -declare(strict_types=1); |
|
| 14 | +declare(strict_types = 1); |
|
| 15 | 15 | |
| 16 | 16 | namespace Phpfastcache\Drivers\Sqlite; |
| 17 | 17 | |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if (isset($row[ 'object' ])) { |
|
| 131 | - return $this->decode($row[ 'object' ]); |
|
| 130 | + if (isset($row['object'])) { |
|
| 131 | + return $this->decode($row['object']); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | return null; |
@@ -300,12 +300,12 @@ discard block |
||
| 300 | 300 | $stm = $this->indexing->prepare("SELECT MAX(`db`) as `db` FROM `balancing`"); |
| 301 | 301 | $stm->execute(); |
| 302 | 302 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 303 | - if (!isset($row[ 'db' ])) { |
|
| 303 | + if (!isset($row['db'])) { |
|
| 304 | 304 | $db = 1; |
| 305 | - } elseif ($row[ 'db' ] <= 1) { |
|
| 305 | + } elseif ($row['db'] <= 1) { |
|
| 306 | 306 | $db = 1; |
| 307 | 307 | } else { |
| 308 | - $db = $row[ 'db' ]; |
|
| 308 | + $db = $row['db']; |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | // check file size |
@@ -327,8 +327,8 @@ discard block |
||
| 327 | 327 | ':keyword' => $keyword, |
| 328 | 328 | ]); |
| 329 | 329 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 330 | - if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
|
| 331 | - $db = $row[ 'db' ]; |
|
| 330 | + if (isset($row['db']) && $row['db'] != '') { |
|
| 331 | + $db = $row['db']; |
|
| 332 | 332 | } else { |
| 333 | 333 | /* |
| 334 | 334 | * Insert new to Indexing |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | /** |
| 360 | 360 | * init instant |
| 361 | 361 | */ |
| 362 | - if (!isset($this->instance[ $instant ])) { |
|
| 362 | + if (!isset($this->instance[$instant])) { |
|
| 363 | 363 | // check DB Files ready or not |
| 364 | 364 | $createTable = false; |
| 365 | 365 | if (!\file_exists($this->SqliteDir . '/db' . $instant) || $reset == true) { |
@@ -372,12 +372,12 @@ discard block |
||
| 372 | 372 | $this->initDB($PDO); |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - $this->instance[ $instant ] = $PDO; |
|
| 375 | + $this->instance[$instant] = $PDO; |
|
| 376 | 376 | unset($PDO); |
| 377 | 377 | |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | - return $this->instance[ $instant ]; |
|
| 380 | + return $this->instance[$instant]; |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /** |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * @param \Psr\Cache\CacheItemInterface $item |
| 91 | - * @return mixed |
|
| 91 | + * @return boolean |
|
| 92 | 92 | * @throws phpFastCacheInvalidArgumentException |
| 93 | 93 | */ |
| 94 | 94 | protected function driverWrite(CacheItemInterface $item): bool |
@@ -20,7 +20,6 @@ |
||
| 20 | 20 | use Phpfastcache\Exceptions\{ |
| 21 | 21 | phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheDriverException |
| 22 | 22 | }; |
| 23 | -use Phpfastcache\Util\ArrayObject; |
|
| 24 | 23 | use phpssdb\Core\{SimpleSSDB, SSDBException}; |
| 25 | 24 | use Psr\Cache\CacheItemInterface; |
| 26 | 25 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
| 19 | 19 | use Phpfastcache\Entities\DriverStatistic; |
| 20 | 20 | use Phpfastcache\Exceptions\{ |
| 21 | - phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheDriverException |
|
| 21 | + phpFastCacheInvalidArgumentException, phpFastCacheDriverCheckException, phpFastCacheDriverException |
|
| 22 | 22 | }; |
| 23 | 23 | use Phpfastcache\Util\ArrayObject; |
| 24 | 24 | use phpssdb\Core\{SimpleSSDB, SSDBException}; |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | * using hardcoded offset of pair key-value :-( |
| 148 | 148 | */ |
| 149 | 149 | $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ])) |
| 150 | - ->setRawData($info) |
|
| 151 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 152 | - ->setSize($this->instance->dbsize()); |
|
| 150 | + ->setRawData($info) |
|
| 151 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 152 | + ->setSize($this->instance->dbsize()); |
|
| 153 | 153 | |
| 154 | 154 | return $stat; |
| 155 | 155 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -declare(strict_types=1); |
|
| 14 | +declare(strict_types = 1); |
|
| 15 | 15 | |
| 16 | 16 | namespace Phpfastcache\Drivers\Ssdb; |
| 17 | 17 | |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | try { |
| 58 | 58 | $clientConfig = $this->getConfig(); |
| 59 | 59 | |
| 60 | - $this->instance = new SimpleSSDB($clientConfig[ 'host' ], $clientConfig[ 'port' ], $clientConfig[ 'timeout' ]); |
|
| 61 | - if (!empty($clientConfig[ 'password' ])) { |
|
| 62 | - $this->instance->auth($clientConfig[ 'password' ]); |
|
| 60 | + $this->instance = new SimpleSSDB($clientConfig['host'], $clientConfig['port'], $clientConfig['timeout']); |
|
| 61 | + if (!empty($clientConfig['password'])) { |
|
| 62 | + $this->instance->auth($clientConfig['password']); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (!$this->instance) { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * Data returned by Ssdb are very poorly formatted |
| 147 | 147 | * using hardcoded offset of pair key-value :-( |
| 148 | 148 | */ |
| 149 | - $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[ 2 ], $info[ 6 ])) |
|
| 149 | + $stat->setInfo(\sprintf("Ssdb-server v%s with a total of %s call(s).\n For more information see RawData.", $info[2], $info[6])) |
|
| 150 | 150 | ->setRawData($info) |
| 151 | 151 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 152 | 152 | ->setSize($this->instance->dbsize()); |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * @param \Psr\Cache\CacheItemInterface $item |
| 69 | - * @return mixed |
|
| 69 | + * @return boolean |
|
| 70 | 70 | * @throws phpFastCacheInvalidArgumentException |
| 71 | 71 | */ |
| 72 | 72 | protected function driverWrite(CacheItemInterface $item): bool |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
| 19 | 19 | use Phpfastcache\Entities\DriverStatistic; |
| 20 | 20 | use Phpfastcache\Exceptions\{ |
| 21 | - phpFastCacheInvalidArgumentException |
|
| 21 | + phpFastCacheInvalidArgumentException |
|
| 22 | 22 | }; |
| 23 | 23 | use Psr\Cache\CacheItemInterface; |
| 24 | 24 | |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]); |
| 122 | 122 | |
| 123 | 123 | return (new DriverStatistic()) |
| 124 | - ->setInfo(\sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
| 125 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
| 126 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 127 | - ->setRawData($memInfo); |
|
| 124 | + ->setInfo(\sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
| 125 | + ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
| 126 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 127 | + ->setRawData($memInfo); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -declare(strict_types=1); |
|
| 14 | +declare(strict_types = 1); |
|
| 15 | 15 | |
| 16 | 16 | namespace Phpfastcache\Drivers\Wincache; |
| 17 | 17 | |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $memInfo = wincache_ucache_meminfo(); |
| 120 | 120 | $info = wincache_ucache_info(); |
| 121 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]); |
|
| 121 | + $date = (new \DateTime())->setTimestamp(time() - $info['total_cache_uptime']); |
|
| 122 | 122 | |
| 123 | 123 | return (new DriverStatistic()) |
| 124 | 124 | ->setInfo(\sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
| 125 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
| 125 | + ->setSize($memInfo['memory_free'] - $memInfo['memory_total']) |
|
| 126 | 126 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 127 | 127 | ->setRawData($memInfo); |
| 128 | 128 | } |
@@ -23,6 +23,7 @@ |
||
| 23 | 23 | { |
| 24 | 24 | /** |
| 25 | 25 | * @inheritdoc |
| 26 | + * @param phpFastCacheIOException $previous |
|
| 26 | 27 | */ |
| 27 | 28 | public function __construct($message = "", $code = 0, $previous = null) |
| 28 | 29 | { |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | public function __construct($message = "", $code = 0, $previous = null) |
| 28 | 28 | { |
| 29 | 29 | $lastError = error_get_last(); |
| 30 | - if($lastError){ |
|
| 30 | + if ($lastError) { |
|
| 31 | 31 | $message .= "\n"; |
| 32 | 32 | $message .= "Additional information provided by error_get_last():\n"; |
| 33 | 33 | $message .= "{$lastError['message']} in {$lastError['file']} line {$lastError['line']}"; |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | * @author Georges.L (Geolim4) <[email protected]> |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -declare(strict_types=1); |
|
| 14 | +declare(strict_types = 1); |
|
| 15 | 15 | |
| 16 | 16 | namespace Phpfastcache\Entities; |
| 17 | 17 | |