@@ -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->getConfigOption( 'itemDetailedDate')) { |
| 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->getConfigOption('cacheSlamsTimeout')); |
|
| 344 | + ->set(new ItemBatch($item->getKey(), new \DateTime())) |
|
| 345 | + ->expiresAfter($this->getConfigOption('cacheSlamsTimeout')); |
|
| 346 | 346 | |
| 347 | 347 | /** |
| 348 | 348 | * To avoid SPL mismatches |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | protected static function cleanFileName($filename): string |
| 193 | 193 | { |
| 194 | 194 | $regex = [ |
| 195 | - '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
| 196 | - '/\.$/', |
|
| 197 | - '/^\./', |
|
| 195 | + '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
| 196 | + '/\.$/', |
|
| 197 | + '/^\./', |
|
| 198 | 198 | ]; |
| 199 | 199 | $replace = ['-', '', '']; |
| 200 | 200 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $tmpFilename = Directory::getAbsolutePath(\dirname($file) . '/tmp_' . \md5( |
| 291 | 291 | \str_shuffle(\uniqid($this->getDriverName(), false)) |
| 292 | 292 | . \str_shuffle(\uniqid($this->getDriverName(), false)) |
| 293 | - )); |
|
| 293 | + )); |
|
| 294 | 294 | |
| 295 | 295 | $f = \fopen($tmpFilename, 'w+'); |
| 296 | 296 | \flock($f, LOCK_EX); |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | $stat->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 335 | - ->setRawData([ |
|
| 335 | + ->setRawData([ |
|
| 336 | 336 | 'tmp' => $this->tmp, |
| 337 | - ]) |
|
| 338 | - ->setSize(Directory::dirSize($path)) |
|
| 339 | - ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
| 337 | + ]) |
|
| 338 | + ->setSize(Directory::dirSize($path)) |
|
| 339 | + ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
| 340 | 340 | |
| 341 | 341 | return $stat; |
| 342 | 342 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | return true; |
| 42 | 42 | } else if (\constant($CONSTANT_NAME) !== $driverName) { |
| 43 | 43 | trigger_error('Memcache collision detected, you used both Memcache and Memcached driver in your script, this may leads to unexpected behaviours', |
| 44 | - E_USER_WARNING); |
|
| 44 | + E_USER_WARNING); |
|
| 45 | 45 | |
| 46 | 46 | return false; |
| 47 | 47 | } |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | if(array_diff_key($array, get_object_vars($this))){ |
| 102 | 102 | throw new PhpfastcacheInvalidConfigurationException(\sprintf( |
| 103 | - 'Invalid option(s) for the config %s: %s', |
|
| 104 | - static::class, |
|
| 105 | - implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 103 | + 'Invalid option(s) for the config %s: %s', |
|
| 104 | + static::class, |
|
| 105 | + implode(', ', array_keys(array_diff_key($array, get_object_vars($this)))) |
|
| 106 | 106 | )); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | $typeHintExpected = ($parameter instanceof \ReflectionParameter ? ($parameter->getType() === 'object' ? $parameter->getClass() : $parameter->getType()) : 'Unknown type'); |
| 135 | 135 | |
| 136 | 136 | throw new PhpfastcacheInvalidConfigurationException(\sprintf( |
| 137 | - 'Invalid type hint found for "%s", expected "%s" got "%s"', |
|
| 138 | - lcfirst(substr($method, 3)), |
|
| 139 | - $typeHintExpected, |
|
| 140 | - $typeHintGot |
|
| 137 | + 'Invalid type hint found for "%s", expected "%s" got "%s"', |
|
| 138 | + lcfirst(substr($method, 3)), |
|
| 139 | + $typeHintExpected, |
|
| 140 | + $typeHintGot |
|
| 141 | 141 | )); |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -331,9 +331,9 @@ discard block |
||
| 331 | 331 | { |
| 332 | 332 | if($fallbackConfig !== null && !($fallbackConfig instanceof self)){ |
| 333 | 333 | throw new PhpfastcacheInvalidArgumentException(\sprintf( |
| 334 | - 'Invalid argument "%s" for %s', |
|
| 335 | - gettype($fallbackConfig) === 'object' ? get_class($fallbackConfig) : gettype($fallbackConfig), |
|
| 336 | - __METHOD__ |
|
| 334 | + 'Invalid argument "%s" for %s', |
|
| 335 | + gettype($fallbackConfig) === 'object' ? get_class($fallbackConfig) : gettype($fallbackConfig), |
|
| 336 | + __METHOD__ |
|
| 337 | 337 | )); |
| 338 | 338 | } |
| 339 | 339 | $this->fallbackConfig = $fallbackConfig; |
@@ -432,10 +432,10 @@ discard block |
||
| 432 | 432 | * by opening a pull request :) |
| 433 | 433 | */ |
| 434 | 434 | static $safeFileExtensions = [ |
| 435 | - 'txt', |
|
| 436 | - 'cache', |
|
| 437 | - 'db', |
|
| 438 | - 'pfc', |
|
| 435 | + 'txt', |
|
| 436 | + 'cache', |
|
| 437 | + 'db', |
|
| 438 | + 'pfc', |
|
| 439 | 439 | ]; |
| 440 | 440 | |
| 441 | 441 | if (\strpos($cacheFileExtension, '.') !== false) { |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | } |
| 444 | 444 | if (!\in_array($cacheFileExtension, $safeFileExtensions, true)) { |
| 445 | 445 | throw new PhpfastcacheInvalidConfigurationException( |
| 446 | - "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions) |
|
| 446 | + "{$cacheFileExtension} is not a safe extension, currently allowed extension: " . \implode(', ', $safeFileExtensions) |
|
| 447 | 447 | ); |
| 448 | 448 | } |
| 449 | 449 | |
@@ -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 | } |
@@ -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 | |
@@ -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 |
@@ -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 |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | use Phpfastcache\Config\ConfigurationOption; |
| 19 | 19 | use Phpfastcache\Core\Pool\{ |
| 20 | - DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
| 20 | + DriverBaseTrait, ExtendedCacheItemPoolInterface |
|
| 21 | 21 | }; |
| 22 | 22 | use Phpfastcache\Entities\DriverStatistic; |
| 23 | 23 | use Phpfastcache\Exceptions\{ |
| 24 | - PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
| 24 | + PhpfastcacheInvalidArgumentException, PhpfastcacheLogicException |
|
| 25 | 25 | }; |
| 26 | 26 | use Phpfastcache\Util\ArrayObject; |
| 27 | 27 | use Psr\Cache\CacheItemInterface; |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | $date = (new \DateTime())->setTimestamp(\time() - $info[ 'uptime_in_seconds' ]); |
| 163 | 163 | |
| 164 | 164 | return (new DriverStatistic()) |
| 165 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 166 | - ->setRawData($info) |
|
| 167 | - ->setSize((int)$info[ 'used_memory' ]) |
|
| 168 | - ->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.", |
|
| 165 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 166 | + ->setRawData($info) |
|
| 167 | + ->setSize((int)$info[ 'used_memory' ]) |
|
| 168 | + ->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.", |
|
| 169 | 169 | $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | \ No newline at end of file |