@@ -36,9 +36,9 @@ |
||
| 36 | 36 | * @var array |
| 37 | 37 | */ |
| 38 | 38 | protected $buckets = [ |
| 39 | - [ |
|
| 39 | + [ |
|
| 40 | 40 | 'bucket' => 'default', |
| 41 | - ], |
|
| 41 | + ], |
|
| 42 | 42 | ]; |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | use CouchbaseCluster as CouchbaseClient; |
| 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; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | $this->instance = new CouchbaseClient( |
| 76 | - 'couchbase://' . $clientConfig->getHost() . ($clientConfig->getPort() ? ":{$clientConfig->getPort()}" : '') |
|
| 76 | + 'couchbase://' . $clientConfig->getHost() . ($clientConfig->getPort() ? ":{$clientConfig->getPort()}" : '') |
|
| 77 | 77 | ); |
| 78 | 78 | |
| 79 | 79 | $this->instance->authenticate($authenticator); |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | $info = $this->getBucket()->manager()->info(); |
| 190 | 190 | |
| 191 | 191 | return (new DriverStatistic()) |
| 192 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 193 | - ->setRawData($info) |
|
| 194 | - ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 195 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 196 | - 1) . "\n For more information see RawData."); |
|
| 192 | + ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 193 | + ->setRawData($info) |
|
| 194 | + ->setData(\implode(', ', \array_keys($this->itemInstances))) |
|
| 195 | + ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 196 | + 1) . "\n For more information see RawData."); |
|
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | \ No newline at end of file |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | $this->instance->authenticate($authenticator); |
| 80 | 80 | |
| 81 | 81 | foreach ($clientConfig->getBuckets() as $bucket) { |
| 82 | - $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ]; |
|
| 83 | - $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ])); |
|
| 82 | + $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket']; |
|
| 83 | + $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'])); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | return true; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | if ($item instanceof Item) { |
| 116 | 116 | try { |
| 117 | - return (bool)$this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]); |
|
| 117 | + return (bool) $this->getBucket()->upsert($item->getEncodedKey(), $this->encode($this->driverPreWrap($item)), ['expiry' => $item->getTtl()]); |
|
| 118 | 118 | } catch (\CouchbaseException $e) { |
| 119 | 119 | return false; |
| 120 | 120 | } |
@@ -134,9 +134,9 @@ discard block |
||
| 134 | 134 | * Check for Cross-Driver type confusion |
| 135 | 135 | */ |
| 136 | 136 | if ($item instanceof Item) { |
| 137 | - try{ |
|
| 138 | - return (bool)$this->getBucket()->remove($item->getEncodedKey()); |
|
| 139 | - }catch (\Couchbase\Exception $e){ |
|
| 137 | + try { |
|
| 138 | + return (bool) $this->getBucket()->remove($item->getEncodedKey()); |
|
| 139 | + } catch (\Couchbase\Exception $e) { |
|
| 140 | 140 | return $e->getCode() === COUCHBASE_KEY_ENOENT; |
| 141 | 141 | } |
| 142 | 142 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | protected function getBucket(): \CouchbaseBucket |
| 160 | 160 | { |
| 161 | - return $this->bucketInstances[ $this->bucketCurrent ]; |
|
| 161 | + return $this->bucketInstances[$this->bucketCurrent]; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket) |
| 170 | 170 | { |
| 171 | 171 | if (!\array_key_exists($bucketName, $this->bucketInstances)) { |
| 172 | - $this->bucketInstances[ $bucketName ] = $CouchbaseBucket; |
|
| 172 | + $this->bucketInstances[$bucketName] = $CouchbaseBucket; |
|
| 173 | 173 | } else { |
| 174 | 174 | throw new PhpfastcacheLogicException('A bucket instance with this name already exists.'); |
| 175 | 175 | } |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | $info = $this->getBucket()->manager()->info(); |
| 190 | 190 | |
| 191 | 191 | return (new DriverStatistic()) |
| 192 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 192 | + ->setSize($info['basicStats']['diskUsed']) |
|
| 193 | 193 | ->setRawData($info) |
| 194 | 194 | ->setData(\implode(', ', \array_keys($this->itemInstances))) |
| 195 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, |
|
| 195 | + ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, |
|
| 196 | 196 | 1) . "\n For more information see RawData."); |
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | \ No newline at end of file |