@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | use Phpfastcache\Config\ConfigurationOption; |
| 19 | 19 | use Phpfastcache\Core\Item\ExtendedCacheItemInterface; |
| 20 | 20 | use Phpfastcache\Exceptions\{ |
| 21 | - PhpfastcacheInvalidArgumentException, PhpfastcacheDriverCheckException, PhpfastcacheLogicException |
|
| 21 | + PhpfastcacheInvalidArgumentException, PhpfastcacheDriverCheckException, PhpfastcacheLogicException |
|
| 22 | 22 | }; |
| 23 | 23 | use Phpfastcache\Util\ArrayObject; |
| 24 | 24 | |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | public function driverPreWrap(ExtendedCacheItemInterface $item): array |
| 164 | 164 | { |
| 165 | 165 | $wrap = [ |
| 166 | - self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
| 167 | - self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
| 168 | - self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
| 166 | + self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
| 167 | + self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
| 168 | + self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
| 169 | 169 | ]; |
| 170 | 170 | |
| 171 | 171 | if ($this->getConfig()->isItemDetailedDate()) { |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | use Phpfastcache\Entities\ItemBatch; |
| 22 | 22 | use Phpfastcache\Util\ClassNamespaceResolverTrait; |
| 23 | 23 | use Phpfastcache\Exceptions\{ |
| 24 | - PhpfastcacheInvalidArgumentException, PhpfastcacheCoreException, PhpfastcacheLogicException |
|
| 24 | + PhpfastcacheInvalidArgumentException, PhpfastcacheCoreException, PhpfastcacheLogicException |
|
| 25 | 25 | }; |
| 26 | 26 | use Phpfastcache\Config\ConfigurationOption; |
| 27 | 27 | use Psr\Cache\CacheItemInterface; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | if ($driverArray) { |
| 91 | 91 | if (!\is_array($driverArray)) { |
| 92 | 92 | throw new PhpfastcacheCoreException(\sprintf('The driverRead method returned an unexpected variable type: %s', |
| 93 | - \gettype($driverArray))); |
|
| 93 | + \gettype($driverArray))); |
|
| 94 | 94 | } |
| 95 | 95 | $driverData = $this->driverUnwrapData($driverArray); |
| 96 | 96 | |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | * Reset the Item |
| 156 | 156 | */ |
| 157 | 157 | $item->set(null) |
| 158 | - ->expiresAfter(\abs((int)$this->getConfig()[ 'defaultTtl' ])) |
|
| 159 | - ->setHit(false) |
|
| 160 | - ->setTags([]); |
|
| 158 | + ->expiresAfter(\abs((int)$this->getConfig()[ 'defaultTtl' ])) |
|
| 159 | + ->setHit(false) |
|
| 160 | + ->setTags([]); |
|
| 161 | 161 | if ($this->getConfig()->isItemDetailedDate()) { |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -341,8 +341,8 @@ discard block |
||
| 341 | 341 | $class = new \ReflectionClass((new \ReflectionObject($this))->getNamespaceName() . '\Item'); |
| 342 | 342 | $itemBatch = $class->newInstanceArgs([$this, $item->getKey()]); |
| 343 | 343 | $itemBatch->setEventManager($this->eventManager) |
| 344 | - ->set(new ItemBatch($item->getKey(), new \DateTime())) |
|
| 345 | - ->expiresAfter($this->getConfig()->getCacheSlamsTimeout()); |
|
| 344 | + ->set(new ItemBatch($item->getKey(), new \DateTime())) |
|
| 345 | + ->expiresAfter($this->getConfig()->getCacheSlamsTimeout()); |
|
| 346 | 346 | |
| 347 | 347 | /** |
| 348 | 348 | * To avoid SPL mismatches |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | use Phpfastcache\Config\ConfigurationOption; |
| 19 | 19 | use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
| 20 | 20 | use Phpfastcache\Exceptions\{ |
| 21 | - PhpfastcacheDeprecatedException, PhpfastcacheDriverCheckException, PhpfastcacheDriverNotFoundException, PhpfastcacheInstanceNotFoundException, PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidConfigurationException, PhpfastcacheLogicException, PhpfastcacheUnsupportedOperationException |
|
| 21 | + PhpfastcacheDeprecatedException, PhpfastcacheDriverCheckException, PhpfastcacheDriverNotFoundException, PhpfastcacheInstanceNotFoundException, PhpfastcacheInvalidArgumentException, PhpfastcacheInvalidConfigurationException, PhpfastcacheLogicException, PhpfastcacheUnsupportedOperationException |
|
| 22 | 22 | }; |
| 23 | 23 | use Phpfastcache\Util\ClassNamespaceResolverTrait; |
| 24 | 24 | |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | if (\is_array($config)) { |
| 103 | 103 | $config = new ConfigurationOption($config); |
| 104 | 104 | trigger_error( |
| 105 | - 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
|
| 106 | - E_USER_DEPRECATED |
|
| 105 | + 'The CacheManager will drops the support of primitive configuration arrays, use a "\Phpfastcache\Config\ConfigurationOption" object instead', |
|
| 106 | + E_USER_DEPRECATED |
|
| 107 | 107 | ); |
| 108 | 108 | }elseif ($config === null){ |
| 109 | 109 | $config = self::getDefaultConfig(); |
@@ -304,27 +304,27 @@ discard block |
||
| 304 | 304 | { |
| 305 | 305 | trigger_error(\sprintf('Method "%s" is deprecated as of the V7 and will be removed soon or later, use CacheManager::getDriverList() instead.', __METHOD__), E_USER_DEPRECATED); |
| 306 | 306 | return [ |
| 307 | - 'Apc', |
|
| 308 | - 'Apcu', |
|
| 309 | - 'Cassandra', |
|
| 310 | - 'Couchbase', |
|
| 311 | - 'Couchdb', |
|
| 312 | - 'Devnull', |
|
| 313 | - 'Files', |
|
| 314 | - 'Leveldb', |
|
| 315 | - 'Memcache', |
|
| 316 | - 'Memcached', |
|
| 317 | - 'Memstatic', |
|
| 318 | - 'Mongodb', |
|
| 319 | - 'Predis', |
|
| 320 | - 'Redis', |
|
| 321 | - 'Riak', |
|
| 322 | - 'Ssdb', |
|
| 323 | - 'Sqlite', |
|
| 324 | - 'Wincache', |
|
| 325 | - 'Xcache', |
|
| 326 | - 'Zenddisk', |
|
| 327 | - 'Zendshm', |
|
| 307 | + 'Apc', |
|
| 308 | + 'Apcu', |
|
| 309 | + 'Cassandra', |
|
| 310 | + 'Couchbase', |
|
| 311 | + 'Couchdb', |
|
| 312 | + 'Devnull', |
|
| 313 | + 'Files', |
|
| 314 | + 'Leveldb', |
|
| 315 | + 'Memcache', |
|
| 316 | + 'Memcached', |
|
| 317 | + 'Memstatic', |
|
| 318 | + 'Mongodb', |
|
| 319 | + 'Predis', |
|
| 320 | + 'Redis', |
|
| 321 | + 'Riak', |
|
| 322 | + 'Ssdb', |
|
| 323 | + 'Sqlite', |
|
| 324 | + 'Wincache', |
|
| 325 | + 'Xcache', |
|
| 326 | + 'Zenddisk', |
|
| 327 | + 'Zendshm', |
|
| 328 | 328 | ]; |
| 329 | 329 | } |
| 330 | 330 | |
@@ -336,9 +336,9 @@ discard block |
||
| 336 | 336 | { |
| 337 | 337 | trigger_error(\sprintf('Method "%s" is deprecated as of the V7 and will be removed soon or later, use CacheManager::getDriverList() instead.', __METHOD__), E_USER_DEPRECATED); |
| 338 | 338 | return \array_merge(self::getStaticSystemDrivers(), [ |
| 339 | - 'Devtrue', |
|
| 340 | - 'Devfalse', |
|
| 341 | - 'Cookie', |
|
| 339 | + 'Devtrue', |
|
| 340 | + 'Devfalse', |
|
| 341 | + 'Cookie', |
|
| 342 | 342 | ]); |
| 343 | 343 | } |
| 344 | 344 | |
@@ -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->getConfig()->getPath())){ |
| 59 | 59 | $this->instance = new PredisClient([ |
| 60 | - 'scheme' => 'unix', |
|
| 61 | - 'path' => $this->getConfig()->getPath() |
|
| 60 | + 'scheme' => 'unix', |
|
| 61 | + 'path' => $this->getConfig()->getPath() |
|
| 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 |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
| 21 | 21 | use Phpfastcache\Entities\DriverStatistic; |
| 22 | 22 | use Phpfastcache\Exceptions\{ |
| 23 | - PhpfastcacheInvalidArgumentException, PhpfastcacheDriverException |
|
| 23 | + PhpfastcacheInvalidArgumentException, PhpfastcacheDriverException |
|
| 24 | 24 | }; |
| 25 | 25 | use Phpfastcache\Util\{ArrayObject, MemcacheDriverCollisionDetectorTrait}; |
| 26 | 26 | use Psr\Cache\CacheItemInterface; |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | if (\count($servers) < 1) { |
| 76 | 76 | $servers = [ |
| 77 | - [ |
|
| 77 | + [ |
|
| 78 | 78 | 'host' => $this->getConfig()->getHost(), |
| 79 | 79 | 'path' => $this->getConfig()->getPath(), |
| 80 | 80 | 'port' => $this->getConfig()->getPort(), |
| 81 | 81 | 'saslUser' => $this->getConfig()->getSaslUser() ?: false, |
| 82 | 82 | 'saslPassword' => $this->getConfig()->getSaslPassword() ?: false, |
| 83 | - ], |
|
| 83 | + ], |
|
| 84 | 84 | ]; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -197,9 +197,9 @@ discard block |
||
| 197 | 197 | $date = (new \DateTime())->setTimestamp(\time() - $stats[ 'uptime' ]); |
| 198 | 198 | |
| 199 | 199 | return (new DriverStatistic()) |
| 200 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 201 | - ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 202 | - ->setRawData($stats) |
|
| 203 | - ->setSize((int)$stats[ 'bytes' ]); |
|
| 200 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 201 | + ->setInfo(\sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 202 | + ->setRawData($stats) |
|
| 203 | + ->setSize((int)$stats[ 'bytes' ]); |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | \ No newline at end of file |
@@ -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) { |
@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | if ($item instanceof Item) { |
| 148 | 148 | try { |
| 149 | 149 | $stm = $this->getDb($item->getKey()) |
| 150 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 150 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 151 | 151 | $stm->execute([ |
| 152 | - ':keyword' => $item->getKey(), |
|
| 153 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 154 | - ':exp' => $item->getExpirationDate()->getTimestamp(), |
|
| 152 | + ':keyword' => $item->getKey(), |
|
| 153 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 154 | + ':exp' => $item->getExpirationDate()->getTimestamp(), |
|
| 155 | 155 | ]); |
| 156 | 156 | |
| 157 | 157 | return true; |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | if ($item instanceof Item) { |
| 177 | 177 | try { |
| 178 | 178 | $stm = $this->getDb($item->getKey()) |
| 179 | - ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
| 179 | + ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
| 180 | 180 | |
| 181 | 181 | return $stm->execute([ |
| 182 | - ':keyword' => $item->getKey(), |
|
| 183 | - ':U' => \time(), |
|
| 182 | + ':keyword' => $item->getKey(), |
|
| 183 | + ':U' => \time(), |
|
| 184 | 184 | ]); |
| 185 | 185 | } catch (PDOException $e) { |
| 186 | 186 | return false; |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | $PDO = new PDO("sqlite:" . $this->SqliteDir . '/' . self::INDEXING_FILE); |
| 262 | 262 | $PDO->setAttribute(PDO::ATTR_ERRMODE, |
| 263 | - PDO::ERRMODE_EXCEPTION); |
|
| 263 | + PDO::ERRMODE_EXCEPTION); |
|
| 264 | 264 | |
| 265 | 265 | if ($createTable == true) { |
| 266 | 266 | $this->initIndexing($PDO); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | // look for keyword |
| 296 | 296 | $stm = $this->indexing->prepare("SELECT * FROM `balancing` WHERE `keyword`=:keyword LIMIT 1"); |
| 297 | 297 | $stm->execute([ |
| 298 | - ':keyword' => $keyword, |
|
| 298 | + ':keyword' => $keyword, |
|
| 299 | 299 | ]); |
| 300 | 300 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 301 | 301 | if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | $db = $this->currentDB; |
| 308 | 308 | $stm = $this->indexing->prepare("INSERT INTO `balancing` (`keyword`,`db`) VALUES(:keyword, :db)"); |
| 309 | 309 | $stm->execute([ |
| 310 | - ':keyword' => $keyword, |
|
| 311 | - ':db' => $db, |
|
| 310 | + ':keyword' => $keyword, |
|
| 311 | + ':db' => $db, |
|
| 312 | 312 | ]); |
| 313 | 313 | } |
| 314 | 314 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; |
| 21 | 21 | use Phpfastcache\Entities\DriverStatistic; |
| 22 | 22 | use Phpfastcache\Exceptions\{ |
| 23 | - PhpfastcacheInvalidArgumentException, PhpfastcacheDriverException |
|
| 23 | + PhpfastcacheInvalidArgumentException, PhpfastcacheDriverException |
|
| 24 | 24 | }; |
| 25 | 25 | use Phpfastcache\Util\{ArrayObject, MemcacheDriverCollisionDetectorTrait}; |
| 26 | 26 | use Psr\Cache\CacheItemInterface; |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | if (\count($servers) < 1) { |
| 72 | 72 | $servers = [ |
| 73 | - [ |
|
| 73 | + [ |
|
| 74 | 74 | 'host' => $this->getConfig()->getHost(), |
| 75 | 75 | 'path' => $this->getConfig()->getPath(), |
| 76 | 76 | 'port' => $this->getConfig()->getPort(), |
| 77 | 77 | 'saslUser' => $this->getConfig()->getSaslUser() ?: false, |
| 78 | 78 | 'saslPassword' => $this->getConfig()->getSaslPassword() ?: false, |
| 79 | - ], |
|
| 79 | + ], |
|
| 80 | 80 | ]; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | $date = (new \DateTime())->setTimestamp(\time() - $stats[ 'uptime' ]); |
| 196 | 196 | |
| 197 | 197 | return (new DriverStatistic()) |
| 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))) |
|
| 200 | - ->setRawData($stats) |
|
| 201 | - ->setSize((int)$stats[ 'bytes' ]); |
|
| 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))) |
|
| 200 | + ->setRawData($stats) |
|
| 201 | + ->setSize((int)$stats[ 'bytes' ]); |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | \ No newline at end of file |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | use LogicException; |
| 20 | 20 | use MongoDB\{ |
| 21 | - Client, Database, BSON\Binary, BSON\UTCDateTime, Collection, DeleteResult, Driver\Command, Driver\Exception\Exception as MongoDBException |
|
| 21 | + Client, Database, BSON\Binary, BSON\UTCDateTime, Collection, DeleteResult, Driver\Command, Driver\Exception\Exception as MongoDBException |
|
| 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 | |
| 31 | 31 | use Psr\Cache\CacheItemInterface; |
@@ -78,16 +78,16 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | if ($document) { |
| 80 | 80 | $return = [ |
| 81 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()), |
|
| 82 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()), |
|
| 83 | - self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()), |
|
| 81 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->getData()), |
|
| 82 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->getData()), |
|
| 83 | + self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->toDateTime()->getTimestamp()), |
|
| 84 | 84 | ]; |
| 85 | 85 | |
| 86 | 86 | if(!empty($this->getConfig()->isItemDetailedDate())){ |
| 87 | 87 | $return += [ |
| 88 | - self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_MDATE_WRAPPER_INDEX ]->toDateTime() |
|
| 88 | + self::DRIVER_MDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_MDATE_WRAPPER_INDEX ]->toDateTime() |
|
| 89 | 89 | ->getTimestamp()), |
| 90 | - self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_CDATE_WRAPPER_INDEX ]->toDateTime() |
|
| 90 | + self::DRIVER_CDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_CDATE_WRAPPER_INDEX ]->toDateTime() |
|
| 91 | 91 | ->getTimestamp()), |
| 92 | 92 | ]; |
| 93 | 93 | } |
@@ -112,23 +112,23 @@ discard block |
||
| 112 | 112 | if ($item instanceof Item) { |
| 113 | 113 | try { |
| 114 | 114 | $set = [ |
| 115 | - self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC), |
|
| 116 | - self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC), |
|
| 117 | - self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((\time() + $item->getTtl()) * 1000) : new UTCDateTime(\time() * 1000)), |
|
| 115 | + self::DRIVER_DATA_WRAPPER_INDEX => new Binary($this->encode($item->get()), Binary::TYPE_GENERIC), |
|
| 116 | + self::DRIVER_TAGS_WRAPPER_INDEX => new Binary($this->encode($item->getTags()), Binary::TYPE_GENERIC), |
|
| 117 | + self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new UTCDateTime((\time() + $item->getTtl()) * 1000) : new UTCDateTime(\time() * 1000)), |
|
| 118 | 118 | ]; |
| 119 | 119 | |
| 120 | 120 | if(!empty($this->getConfig()->isItemDetailedDate())){ |
| 121 | 121 | $set += [ |
| 122 | - self::DRIVER_MDATE_WRAPPER_INDEX => ($item->getModificationDate() ? new UTCDateTime(($item->getModificationDate()->getTimestamp()) * 1000) : new UTCDateTime(\time() * 1000)), |
|
| 123 | - self::DRIVER_CDATE_WRAPPER_INDEX => ($item->getCreationDate() ? new UTCDateTime(($item->getCreationDate()->getTimestamp()) * 1000) : new UTCDateTime(\time() * 1000)), |
|
| 122 | + self::DRIVER_MDATE_WRAPPER_INDEX => ($item->getModificationDate() ? new UTCDateTime(($item->getModificationDate()->getTimestamp()) * 1000) : new UTCDateTime(\time() * 1000)), |
|
| 123 | + self::DRIVER_CDATE_WRAPPER_INDEX => ($item->getCreationDate() ? new UTCDateTime(($item->getCreationDate()->getTimestamp()) * 1000) : new UTCDateTime(\time() * 1000)), |
|
| 124 | 124 | ]; |
| 125 | 125 | } |
| 126 | 126 | $result = (array)$this->getCollection()->updateOne( |
| 127 | - ['_id' => $item->getEncodedKey()], |
|
| 128 | - [ |
|
| 127 | + ['_id' => $item->getEncodedKey()], |
|
| 128 | + [ |
|
| 129 | 129 | '$set' => $set, |
| 130 | - ], |
|
| 131 | - ['upsert' => true, 'multiple' => false] |
|
| 130 | + ], |
|
| 131 | + ['upsert' => true, 'multiple' => false] |
|
| 132 | 132 | ); |
| 133 | 133 | } catch (MongoDBException $e) { |
| 134 | 134 | throw new PhpfastcacheDriverException('Got an exception while trying to write data to MongoDB server', null, $e); |
@@ -229,13 +229,13 @@ discard block |
||
| 229 | 229 | $password = $this->getConfig()->getPassword(); |
| 230 | 230 | |
| 231 | 231 | return implode('', [ |
| 232 | - 'mongodb://', |
|
| 233 | - ($username ?: ''), |
|
| 234 | - ($password ? ":{$password}" : ''), |
|
| 235 | - ($username ? '@' : ''), |
|
| 236 | - $host, |
|
| 237 | - ($port !== 27017 ? ":{$port}" : ''), |
|
| 238 | - ($databaseName ? "/{$databaseName}" : '') |
|
| 232 | + 'mongodb://', |
|
| 233 | + ($username ?: ''), |
|
| 234 | + ($password ? ":{$password}" : ''), |
|
| 235 | + ($username ? '@' : ''), |
|
| 236 | + $host, |
|
| 237 | + ($port !== 27017 ? ":{$port}" : ''), |
|
| 238 | + ($databaseName ? "/{$databaseName}" : '') |
|
| 239 | 239 | ]); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -259,15 +259,15 @@ discard block |
||
| 259 | 259 | public function getStats(): DriverStatistic |
| 260 | 260 | { |
| 261 | 261 | $serverStats = $this->instance->getManager()->executeCommand('phpFastCache', new Command([ |
| 262 | - 'serverStatus' => 1, |
|
| 263 | - 'recordStats' => 0, |
|
| 264 | - 'repl' => 0, |
|
| 265 | - 'metrics' => 0, |
|
| 262 | + 'serverStatus' => 1, |
|
| 263 | + 'recordStats' => 0, |
|
| 264 | + 'repl' => 0, |
|
| 265 | + 'metrics' => 0, |
|
| 266 | 266 | ]))->toArray()[ 0 ]; |
| 267 | 267 | |
| 268 | 268 | $collectionStats = $this->instance->getManager()->executeCommand('phpFastCache', new Command([ |
| 269 | - 'collStats' => (isset($this->getConfig()[ 'collectionName' ]) ? $this->getConfig()[ 'collectionName' ] : 'Cache'), |
|
| 270 | - 'verbose' => true, |
|
| 269 | + 'collStats' => (isset($this->getConfig()[ 'collectionName' ]) ? $this->getConfig()[ 'collectionName' ] : 'Cache'), |
|
| 270 | + 'verbose' => true, |
|
| 271 | 271 | ]))->toArray()[ 0 ]; |
| 272 | 272 | |
| 273 | 273 | $array_filter_recursive = function ($array, callable $callback = null) use (&$array_filter_recursive) { |
@@ -296,14 +296,14 @@ discard block |
||
| 296 | 296 | $collectionStats = $array_filter_recursive($collectionStats, $callback); |
| 297 | 297 | |
| 298 | 298 | $stats = (new DriverStatistic()) |
| 299 | - ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . \round($serverStats->uptime / 86400, |
|
| 300 | - 1) . "\n For more information see RawData.") |
|
| 301 | - ->setSize($collectionStats->size) |
|
| 302 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 303 | - ->setRawData([ |
|
| 299 | + ->setInfo('MongoDB version ' . $serverStats->version . ', Uptime (in days): ' . \round($serverStats->uptime / 86400, |
|
| 300 | + 1) . "\n For more information see RawData.") |
|
| 301 | + ->setSize($collectionStats->size) |
|
| 302 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 303 | + ->setRawData([ |
|
| 304 | 304 | 'serverStatus' => $serverStats, |
| 305 | 305 | 'collStats' => $collectionStats, |
| 306 | - ]); |
|
| 306 | + ]); |
|
| 307 | 307 | |
| 308 | 308 | return $stats; |
| 309 | 309 | } |