@@ -46,6 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @inheritdoc |
| 49 | + * @param string $tagName |
|
| 49 | 50 | */ |
| 50 | 51 | public function getItemsByTag($tagName) |
| 51 | 52 | { |
@@ -416,7 +417,7 @@ discard block |
||
| 416 | 417 | |
| 417 | 418 | /** |
| 418 | 419 | * @internal This method de-register an item from $this->itemInstances |
| 419 | - * @param CacheItemInterface|string $item |
|
| 420 | + * @param CacheItemInterface $item |
|
| 420 | 421 | * @throws \InvalidArgumentException |
| 421 | 422 | */ |
| 422 | 423 | protected function deregisterItem($item) |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function getItemsAsJsonString(array $keys = [], $option = 0, $depth = 512) |
| 40 | 40 | { |
| 41 | - $callback = function (CacheItemInterface $item) { |
|
| 41 | + $callback = function(CacheItemInterface $item) { |
|
| 42 | 42 | return $item->get(); |
| 43 | 43 | }; |
| 44 | 44 | return json_encode(array_map($callback, array_values($this->getItems($keys))), $option, $depth); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | if (is_string($tagName)) { |
| 53 | 53 | $driverResponse = $this->getItem($this->getTagKey($tagName)); |
| 54 | 54 | if ($driverResponse->isHit()) { |
| 55 | - $items = (array)$driverResponse->get(); |
|
| 55 | + $items = (array) $driverResponse->get(); |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * getItems() may provides expired item(s) |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * #headache |
| 66 | 66 | */ |
| 67 | - return array_filter($this->getItems(array_unique(array_keys($items))), function (ExtendedCacheItemInterface $item) { |
|
| 67 | + return array_filter($this->getItems(array_unique(array_keys($items))), function(ExtendedCacheItemInterface $item) { |
|
| 68 | 68 | return $item->isHit(); |
| 69 | 69 | }); |
| 70 | 70 | } else { |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | $items = []; |
| 84 | 84 | foreach (array_unique($tagNames) as $tagName) { |
| 85 | - if(is_string($tagName)){ |
|
| 85 | + if (is_string($tagName)) { |
|
| 86 | 86 | $items = array_merge($items, $this->getItemsByTag($tagName)); |
| 87 | - }else{ |
|
| 87 | + } else { |
|
| 88 | 88 | throw new InvalidArgumentException('$tagName must be a a string'); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | foreach ($items as $key => $item) { |
| 104 | 104 | if (array_diff($tagNames, $item->getTags())) { |
| 105 | - unset($items[ $key ]); |
|
| 105 | + unset($items[$key]); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function getItemsByTagsAsJsonString(array $tagNames, $option = 0, $depth = 512) |
| 117 | 117 | { |
| 118 | - $callback = function (CacheItemInterface $item) { |
|
| 118 | + $callback = function(CacheItemInterface $item) { |
|
| 119 | 119 | return $item->get(); |
| 120 | 120 | }; |
| 121 | 121 | |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | */ |
| 387 | 387 | public function detachItem(CacheItemInterface $item) |
| 388 | 388 | { |
| 389 | - if (isset($this->itemInstances[ $item->getKey() ])) { |
|
| 389 | + if (isset($this->itemInstances[$item->getKey()])) { |
|
| 390 | 390 | $this->deregisterItem($item); |
| 391 | 391 | } |
| 392 | 392 | } |
@@ -406,10 +406,10 @@ discard block |
||
| 406 | 406 | */ |
| 407 | 407 | public function attachItem(CacheItemInterface $item) |
| 408 | 408 | { |
| 409 | - if (isset($this->itemInstances[ $item->getKey() ]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])) { |
|
| 409 | + if (isset($this->itemInstances[$item->getKey()]) && spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
| 410 | 410 | throw new \LogicException('The item already exists and cannot be overwritten because the Spl object hash mismatches ! You probably tried to re-attach a detached item which has been already retrieved from cache.'); |
| 411 | 411 | } else { |
| 412 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 412 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | |
@@ -422,10 +422,10 @@ discard block |
||
| 422 | 422 | protected function deregisterItem($item) |
| 423 | 423 | { |
| 424 | 424 | if ($item instanceof CacheItemInterface) { |
| 425 | - unset($this->itemInstances[ $item->getKey() ]); |
|
| 425 | + unset($this->itemInstances[$item->getKey()]); |
|
| 426 | 426 | |
| 427 | 427 | } else if (is_string($item)) { |
| 428 | - unset($this->itemInstances[ $item ]); |
|
| 428 | + unset($this->itemInstances[$item]); |
|
| 429 | 429 | } else { |
| 430 | 430 | throw new \InvalidArgumentException('Invalid type for $item variable'); |
| 431 | 431 | } |
@@ -445,8 +445,8 @@ discard block |
||
| 445 | 445 | */ |
| 446 | 446 | public function isAttached(CacheItemInterface $item) |
| 447 | 447 | { |
| 448 | - if (isset($this->itemInstances[ $item->getKey() ])) { |
|
| 449 | - return spl_object_hash($item) === spl_object_hash($this->itemInstances[ $item->getKey() ]); |
|
| 448 | + if (isset($this->itemInstances[$item->getKey()])) { |
|
| 449 | + return spl_object_hash($item) === spl_object_hash($this->itemInstances[$item->getKey()]); |
|
| 450 | 450 | } |
| 451 | 451 | return null; |
| 452 | 452 | } |
@@ -466,8 +466,8 @@ discard block |
||
| 466 | 466 | */ |
| 467 | 467 | public function saveMultiple(...$items) |
| 468 | 468 | { |
| 469 | - if (isset($items[ 0 ]) && is_array($items[ 0 ])) { |
|
| 470 | - foreach ($items[ 0 ] as $item) { |
|
| 469 | + if (isset($items[0]) && is_array($items[0])) { |
|
| 470 | + foreach ($items[0] as $item) { |
|
| 471 | 471 | $this->save($item); |
| 472 | 472 | } |
| 473 | 473 | return true; |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | foreach (array_unique($tagNames) as $tagName) { |
| 85 | 85 | if(is_string($tagName)){ |
| 86 | 86 | $items = array_merge($items, $this->getItemsByTag($tagName)); |
| 87 | - }else{ |
|
| 87 | + } else{ |
|
| 88 | 88 | throw new InvalidArgumentException('$tagName must be a a string'); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $keyword = self::PREFIX . $item->getKey(); |
| 81 | 81 | $v = json_encode($this->driverPreWrap($item)); |
| 82 | 82 | |
| 83 | - if (isset($this->config[ 'limited_memory_each_object' ]) && strlen($v) > $this->config[ 'limited_memory_each_object' ]) { |
|
| 83 | + if (isset($this->config['limited_memory_each_object']) && strlen($v) > $this->config['limited_memory_each_object']) { |
|
| 84 | 84 | return false; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | // return null if no caching |
| 102 | 102 | // return value if in caching |
| 103 | 103 | $keyword = self::PREFIX . $item->getKey(); |
| 104 | - $x = isset($_COOKIE[ $keyword ]) ? json_decode($_COOKIE[ $keyword ], true) : false; |
|
| 104 | + $x = isset($_COOKIE[$keyword]) ? json_decode($_COOKIE[$keyword], true) : false; |
|
| 105 | 105 | |
| 106 | 106 | if ($x == false) { |
| 107 | 107 | return null; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | { |
| 123 | 123 | $this->driverConnect(); |
| 124 | 124 | $keyword = self::PREFIX . $key; |
| 125 | - $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ])->t) : false; |
|
| 125 | + $x = isset($_COOKIE[$keyword]) ? $this->decode(json_decode($_COOKIE[$keyword])->t) : false; |
|
| 126 | 126 | |
| 127 | 127 | return $x ? $x - time() : $x; |
| 128 | 128 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | if ($item instanceof Item) { |
| 141 | 141 | $this->driverConnect(); |
| 142 | 142 | $keyword = self::PREFIX . $item->getKey(); |
| 143 | - $_COOKIE[ $keyword ] = null; |
|
| 143 | + $_COOKIE[$keyword] = null; |
|
| 144 | 144 | |
| 145 | 145 | return @setcookie($keyword, null, -10); |
| 146 | 146 | } else { |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $this->driverConnect(); |
| 158 | 158 | foreach ($_COOKIE as $keyword => $value) { |
| 159 | 159 | if (strpos($keyword, self::PREFIX) !== false) { |
| 160 | - $_COOKIE[ $keyword ] = null; |
|
| 160 | + $_COOKIE[$keyword] = null; |
|
| 161 | 161 | $result = @setcookie($keyword, null, -10); |
| 162 | 162 | if ($return !== false) { |
| 163 | 163 | $return = $result; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function printNewLine($count = 1) |
| 81 | 81 | { |
| 82 | - for($i = 0; $i < $count; $i++){ |
|
| 82 | + for ($i = 0; $i < $count; $i++) { |
|
| 83 | 83 | print PHP_EOL; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function printText($string, $strtoupper = false) |
| 95 | 95 | { |
| 96 | - if(!$strtoupper){ |
|
| 96 | + if (!$strtoupper) { |
|
| 97 | 97 | print trim($string) . PHP_EOL; |
| 98 | - }else{ |
|
| 98 | + } else { |
|
| 99 | 99 | print strtoupper(trim($string) . PHP_EOL); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -273,7 +273,7 @@ |
||
| 273 | 273 | |
| 274 | 274 | if (!is_dir($path)) { |
| 275 | 275 | throw new phpFastCacheDriverException("Can't read PATH:" . $path, 94); |
| 276 | - }else{ |
|
| 276 | + } else{ |
|
| 277 | 277 | $size = Directory::dirSize($path); |
| 278 | 278 | } |
| 279 | 279 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | protected function driverConnect() |
| 126 | 126 | { |
| 127 | - $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : []; |
|
| 127 | + $config = isset($this->config['predis']) ? $this->config['predis'] : []; |
|
| 128 | 128 | |
| 129 | 129 | $this->instance = new PredisClient(array_merge([ |
| 130 | 130 | 'host' => '127.0.0.1', |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $info = $this->instance->info(); |
| 151 | 151 | $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0); |
| 152 | 152 | $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0); |
| 153 | - $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date'); |
|
| 153 | + $date = (isset($info['Server']['uptime_in_seconds']) ? (new \DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date'); |
|
| 154 | 154 | |
| 155 | 155 | return (new driverStatistic()) |
| 156 | 156 | ->setData(implode(', ', array_keys($this->itemInstances))) |
@@ -125,10 +125,10 @@ discard block |
||
| 125 | 125 | $config = isset($this->config[ 'predis' ]) ? $this->config[ 'predis' ] : []; |
| 126 | 126 | |
| 127 | 127 | $this->instance = new PredisClient(array_merge([ |
| 128 | - 'host' => '127.0.0.1', |
|
| 129 | - 'port' => 6379, |
|
| 130 | - 'password' => null, |
|
| 131 | - 'database' => null, |
|
| 128 | + 'host' => '127.0.0.1', |
|
| 129 | + 'port' => 6379, |
|
| 130 | + 'password' => null, |
|
| 131 | + 'database' => null, |
|
| 132 | 132 | ], $config)); |
| 133 | 133 | |
| 134 | 134 | return true; |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date'); |
| 152 | 152 | |
| 153 | 153 | return (new driverStatistic()) |
| 154 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 155 | - ->setRawData($info) |
|
| 156 | - ->setSize($size) |
|
| 157 | - ->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.", $version, $date->format(DATE_RFC2822))); |
|
| 154 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 155 | + ->setRawData($info) |
|
| 156 | + ->setSize($size) |
|
| 157 | + ->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.", $version, $date->format(DATE_RFC2822))); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | \ No newline at end of file |
@@ -63,8 +63,8 @@ |
||
| 63 | 63 | { |
| 64 | 64 | try { |
| 65 | 65 | $cacheItem = $this->internalCacheInstance |
| 66 | - ->getItem($key) |
|
| 67 | - ->set($value); |
|
| 66 | + ->getItem($key) |
|
| 67 | + ->set($value); |
|
| 68 | 68 | if (is_int($ttl) || $ttl instanceof \DateInterval) { |
| 69 | 69 | $cacheItem->expiresAfter($ttl); |
| 70 | 70 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | public function getMultiple($keys, $default = null) |
| 111 | 111 | { |
| 112 | 112 | try { |
| 113 | - return array_map(function (ExtendedCacheItemInterface $item) { |
|
| 113 | + return array_map(function(ExtendedCacheItemInterface $item) { |
|
| 114 | 114 | return $item->get(); |
| 115 | 115 | }, $this->internalCacheInstance->getItems($keys)); |
| 116 | 116 | } catch (phpFastCacheInvalidArgumentException $e) { |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @param \Psr\Cache\CacheItemInterface $item |
| 60 | - * @return mixed |
|
| 60 | + * @return boolean |
|
| 61 | 61 | * @throws \InvalidArgumentException |
| 62 | 62 | */ |
| 63 | 63 | public function driverWrite(CacheItemInterface $item) |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | ); |
| 129 | 129 | $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options); |
| 130 | 130 | |
| 131 | - if($results instanceof Cassandra\Rows && $results->count() === 1){ |
|
| 131 | + if ($results instanceof Cassandra\Rows && $results->count() === 1) { |
|
| 132 | 132 | return $this->decode($results->first()['cache_data']); |
| 133 | - }else{ |
|
| 133 | + } else { |
|
| 134 | 134 | return null; |
| 135 | 135 | } |
| 136 | 136 | } catch (Cassandra\Exception $e) { |
@@ -204,20 +204,20 @@ discard block |
||
| 204 | 204 | if ($this->instance instanceof CouchbaseClient) { |
| 205 | 205 | throw new \LogicException('Already connected to Couchbase server'); |
| 206 | 206 | } else { |
| 207 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 208 | - $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : 9042; |
|
| 209 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 2; |
|
| 210 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 211 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
| 207 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 208 | + $port = isset($this->config['port']) ? $this->config['port'] : 9042; |
|
| 209 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 2; |
|
| 210 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 211 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
| 212 | 212 | |
| 213 | 213 | $clusterBuilder = Cassandra::cluster() |
| 214 | 214 | ->withContactPoints($host) |
| 215 | 215 | ->withPort($port); |
| 216 | 216 | |
| 217 | - if(!empty($this->config['ssl']['enabled'])){ |
|
| 218 | - if(!empty($this->config['ssl']['verify'])){ |
|
| 217 | + if (!empty($this->config['ssl']['enabled'])) { |
|
| 218 | + if (!empty($this->config['ssl']['verify'])) { |
|
| 219 | 219 | $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_PEER_CERT); |
| 220 | - }else{ |
|
| 220 | + } else { |
|
| 221 | 221 | $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_NONE); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | $clusterBuilder->withConnectTimeout($timeout); |
| 228 | 228 | |
| 229 | - if($username){ |
|
| 229 | + if ($username) { |
|
| 230 | 230 | $clusterBuilder->withCredentials($username, $password); |
| 231 | 231 | } |
| 232 | 232 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | ))); |
| 279 | 279 | |
| 280 | 280 | return (new driverStatistic()) |
| 281 | - ->setSize($result->first()[ 'cache_size' ]) |
|
| 281 | + ->setSize($result->first()['cache_size']) |
|
| 282 | 282 | ->setRawData([]) |
| 283 | 283 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 284 | 284 | ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.'); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | if($results instanceof Cassandra\Rows && $results->count() === 1){ |
| 132 | 132 | return $this->decode($results->first()['cache_data']); |
| 133 | - }else{ |
|
| 133 | + } else{ |
|
| 134 | 134 | return null; |
| 135 | 135 | } |
| 136 | 136 | } catch (Cassandra\Exception $e) { |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | if(!empty($this->config['ssl']['enabled'])){ |
| 218 | 218 | if(!empty($this->config['ssl']['verify'])){ |
| 219 | 219 | $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_PEER_CERT); |
| 220 | - }else{ |
|
| 220 | + } else{ |
|
| 221 | 221 | $sslBuilder = Cassandra::ssl()->withVerifyFlags(Cassandra::VERIFY_NONE); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | if ($item instanceof Item) { |
| 74 | 74 | $cacheData = $this->encode($this->driverPreWrap($item)); |
| 75 | 75 | $options = new Cassandra\ExecutionOptions([ |
| 76 | - 'arguments' => [ |
|
| 77 | - 'cache_uuid' => new Cassandra\Uuid(), |
|
| 78 | - 'cache_id' => $item->getKey(), |
|
| 79 | - 'cache_data' => $cacheData, |
|
| 80 | - 'cache_creation_date' => new Cassandra\Timestamp((new \DateTime())->getTimestamp()), |
|
| 81 | - 'cache_expiration_date' => new Cassandra\Timestamp($item->getExpirationDate()->getTimestamp()), |
|
| 82 | - 'cache_length' => strlen($cacheData) |
|
| 76 | + 'arguments' => [ |
|
| 77 | + 'cache_uuid' => new Cassandra\Uuid(), |
|
| 78 | + 'cache_id' => $item->getKey(), |
|
| 79 | + 'cache_data' => $cacheData, |
|
| 80 | + 'cache_creation_date' => new Cassandra\Timestamp((new \DateTime())->getTimestamp()), |
|
| 81 | + 'cache_expiration_date' => new Cassandra\Timestamp($item->getExpirationDate()->getTimestamp()), |
|
| 82 | + 'cache_length' => strlen($cacheData) |
|
| 83 | 83 | ], |
| 84 | - 'consistency' => Cassandra::CONSISTENCY_ALL, |
|
| 85 | - 'serial_consistency' => Cassandra::CONSISTENCY_SERIAL |
|
| 84 | + 'consistency' => Cassandra::CONSISTENCY_ALL, |
|
| 85 | + 'serial_consistency' => Cassandra::CONSISTENCY_SERIAL |
|
| 86 | 86 | ]); |
| 87 | 87 | |
| 88 | 88 | $query = sprintf('INSERT INTO %s.%s |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | try { |
| 119 | 119 | $options = new Cassandra\ExecutionOptions([ |
| 120 | - 'arguments' => ['cache_id' => $item->getKey()], |
|
| 121 | - 'page_size' => 1 |
|
| 120 | + 'arguments' => ['cache_id' => $item->getKey()], |
|
| 121 | + 'page_size' => 1 |
|
| 122 | 122 | ]); |
| 123 | 123 | $query = sprintf( |
| 124 | - 'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;', |
|
| 125 | - self::CASSANDRA_KEY_SPACE, |
|
| 126 | - self::CASSANDRA_TABLE |
|
| 124 | + 'SELECT cache_data FROM %s.%s WHERE cache_id = :cache_id;', |
|
| 125 | + self::CASSANDRA_KEY_SPACE, |
|
| 126 | + self::CASSANDRA_TABLE |
|
| 127 | 127 | ); |
| 128 | 128 | $results = $this->instance->execute(new Cassandra\SimpleStatement($query), $options); |
| 129 | 129 | |
@@ -150,14 +150,14 @@ discard block |
||
| 150 | 150 | if ($item instanceof Item) { |
| 151 | 151 | try { |
| 152 | 152 | $options = new Cassandra\ExecutionOptions([ |
| 153 | - 'arguments' => [ |
|
| 153 | + 'arguments' => [ |
|
| 154 | 154 | 'cache_id' => $item->getKey(), |
| 155 | - ], |
|
| 155 | + ], |
|
| 156 | 156 | ]); |
| 157 | 157 | $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf( |
| 158 | - 'DELETE FROM %s.%s WHERE cache_id = :cache_id;', |
|
| 159 | - self::CASSANDRA_KEY_SPACE, |
|
| 160 | - self::CASSANDRA_TABLE |
|
| 158 | + 'DELETE FROM %s.%s WHERE cache_id = :cache_id;', |
|
| 159 | + self::CASSANDRA_KEY_SPACE, |
|
| 160 | + self::CASSANDRA_TABLE |
|
| 161 | 161 | )), $options); |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | try { |
| 183 | 183 | $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf( |
| 184 | - 'TRUNCATE %s.%s;', |
|
| 185 | - self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE |
|
| 184 | + 'TRUNCATE %s.%s;', |
|
| 185 | + self::CASSANDRA_KEY_SPACE, self::CASSANDRA_TABLE |
|
| 186 | 186 | ))); |
| 187 | 187 | /** |
| 188 | 188 | * There's no real way atm |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
| 211 | 211 | |
| 212 | 212 | $clusterBuilder = Cassandra::cluster() |
| 213 | - ->withContactPoints($host) |
|
| 214 | - ->withPort($port); |
|
| 213 | + ->withContactPoints($host) |
|
| 214 | + ->withPort($port); |
|
| 215 | 215 | |
| 216 | 216 | if(!empty($this->config['ssl']['enabled'])){ |
| 217 | 217 | if(!empty($this->config['ssl']['verify'])){ |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | |
| 241 | 241 | $this->instance->execute(new Cassandra\SimpleStatement(sprintf( |
| 242 | - "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };", |
|
| 243 | - self::CASSANDRA_KEY_SPACE |
|
| 242 | + "CREATE KEYSPACE IF NOT EXISTS %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };", |
|
| 243 | + self::CASSANDRA_KEY_SPACE |
|
| 244 | 244 | ))); |
| 245 | 245 | $this->instance->execute(new Cassandra\SimpleStatement(sprintf('USE %s;', self::CASSANDRA_KEY_SPACE))); |
| 246 | 246 | $this->instance->execute(new Cassandra\SimpleStatement(sprintf(' |
@@ -286,15 +286,15 @@ discard block |
||
| 286 | 286 | public function getStats() |
| 287 | 287 | { |
| 288 | 288 | $result = $this->instance->execute(new Cassandra\SimpleStatement(sprintf( |
| 289 | - 'SELECT SUM(cache_length) as cache_size FROM %s.%s', |
|
| 290 | - self::CASSANDRA_KEY_SPACE, |
|
| 291 | - self::CASSANDRA_TABLE |
|
| 289 | + 'SELECT SUM(cache_length) as cache_size FROM %s.%s', |
|
| 290 | + self::CASSANDRA_KEY_SPACE, |
|
| 291 | + self::CASSANDRA_TABLE |
|
| 292 | 292 | ))); |
| 293 | 293 | |
| 294 | 294 | return (new driverStatistic()) |
| 295 | - ->setSize($result->first()[ 'cache_size' ]) |
|
| 296 | - ->setRawData([]) |
|
| 297 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 298 | - ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.'); |
|
| 295 | + ->setSize($result->first()[ 'cache_size' ]) |
|
| 296 | + ->setRawData([]) |
|
| 297 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 298 | + ->setInfo('The cache size represents only the cache data itself without counting data structures associated to the cache entries.'); |
|
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | \ No newline at end of file |