@@ -42,7 +42,7 @@ |
||
| 42 | 42 | $this->driver->setItem($this); |
| 43 | 43 | } else { |
| 44 | 44 | throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', |
| 45 | - gettype($key))); |
|
| 45 | + gettype($key))); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -83,8 +83,8 @@ |
||
| 83 | 83 | |
| 84 | 84 | $files = new RecursiveIteratorIterator |
| 85 | 85 | ( |
| 86 | - new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 87 | - RecursiveIteratorIterator::CHILD_FIRST |
|
| 86 | + new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
|
| 87 | + RecursiveIteratorIterator::CHILD_FIRST |
|
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | foreach ($files as $fileinfo) { |
@@ -85,8 +85,7 @@ discard block |
||
| 85 | 85 | return unlink($source); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - $files = new RecursiveIteratorIterator |
|
| 89 | - ( |
|
| 88 | + $files = new RecursiveIteratorIterator( |
|
| 90 | 89 | new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), |
| 91 | 90 | RecursiveIteratorIterator::CHILD_FIRST |
| 92 | 91 | ); |
@@ -136,7 +135,7 @@ discard block |
||
| 136 | 135 | /** |
| 137 | 136 | * Allows to dereference char |
| 138 | 137 | */ |
| 139 | - $__FILE__ = preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__);// remove file protocols such as "phar://" etc. |
|
| 138 | + $__FILE__ = preg_replace('~^(([a-z0-9\-]+)://)~', '', __FILE__); // remove file protocols such as "phar://" etc. |
|
| 140 | 139 | $prefix = $__FILE__[0] === DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : ''; |
| 141 | 140 | return $prefix . implode(DIRECTORY_SEPARATOR, $absolutes); |
| 142 | 141 | } |
@@ -140,9 +140,9 @@ |
||
| 140 | 140 | { |
| 141 | 141 | $stat = new driverStatistic(); |
| 142 | 142 | $stat->setInfo('[Devnull] A void info string') |
| 143 | - ->setSize(0) |
|
| 144 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 145 | - ->setRawData(null); |
|
| 143 | + ->setSize(0) |
|
| 144 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 145 | + ->setRawData(null); |
|
| 146 | 146 | |
| 147 | 147 | return $stat; |
| 148 | 148 | } |
@@ -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) |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * @param \Psr\Cache\CacheItemInterface $item |
| 56 | - * @return mixed |
|
| 56 | + * @return boolean |
|
| 57 | 57 | * @throws \InvalidArgumentException |
| 58 | 58 | */ |
| 59 | 59 | public function driverWrite(CacheItemInterface $item) |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | 114 | * @param \Psr\Cache\CacheItemInterface $item |
| 115 | - * @return bool |
|
| 115 | + * @return boolean|null |
|
| 116 | 116 | * @throws \InvalidArgumentException |
| 117 | 117 | */ |
| 118 | 118 | public function driverIsHit(CacheItemInterface $item) |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | if ($item instanceof Item) { |
| 84 | 84 | try { |
| 85 | 85 | $result = (array) $this->getCollection()->update( |
| 86 | - ['_id' => $item->getKey()], |
|
| 87 | - [ |
|
| 86 | + ['_id' => $item->getKey()], |
|
| 87 | + [ |
|
| 88 | 88 | '$set' => [ |
| 89 | - self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : new MongoDate(time())), |
|
| 90 | - self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY), |
|
| 91 | - self::DRIVER_TAGS_WRAPPER_INDEX => new MongoBinData($this->encode($item->getTags()), MongoBinData::BYTE_ARRAY), |
|
| 89 | + self::DRIVER_EDATE_WRAPPER_INDEX => ($item->getTtl() > 0 ? new MongoDate(time() + $item->getTtl()) : new MongoDate(time())), |
|
| 90 | + self::DRIVER_DATA_WRAPPER_INDEX => new MongoBinData($this->encode($item->get()), MongoBinData::BYTE_ARRAY), |
|
| 91 | + self::DRIVER_TAGS_WRAPPER_INDEX => new MongoBinData($this->encode($item->getTags()), MongoBinData::BYTE_ARRAY), |
|
| 92 | 92 | ], |
| 93 | - ], |
|
| 94 | - ['upsert' => true, 'multiple' => false] |
|
| 93 | + ], |
|
| 94 | + ['upsert' => true, 'multiple' => false] |
|
| 95 | 95 | ); |
| 96 | 96 | } catch (MongoCursorException $e) { |
| 97 | 97 | return false; |
@@ -110,14 +110,14 @@ discard block |
||
| 110 | 110 | protected function driverRead(CacheItemInterface $item) |
| 111 | 111 | { |
| 112 | 112 | $document = $this->getCollection() |
| 113 | - ->findOne(['_id' => $item->getKey()], |
|
| 113 | + ->findOne(['_id' => $item->getKey()], |
|
| 114 | 114 | [self::DRIVER_DATA_WRAPPER_INDEX, self::DRIVER_EDATE_WRAPPER_INDEX, self::DRIVER_TAGS_WRAPPER_INDEX /*'d', 'e'*/]); |
| 115 | 115 | |
| 116 | 116 | if ($document) { |
| 117 | 117 | return [ |
| 118 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
| 119 | - self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->sec), |
|
| 120 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin), |
|
| 118 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
| 119 | + self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->sec), |
|
| 120 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin), |
|
| 121 | 121 | ]; |
| 122 | 122 | } else { |
| 123 | 123 | return null; |
@@ -172,10 +172,10 @@ discard block |
||
| 172 | 172 | * @todo make an url builder |
| 173 | 173 | */ |
| 174 | 174 | $this->instance = $this->instance ?: (new MongodbClient('mongodb://' . |
| 175 | - ($username ?: '') . |
|
| 176 | - ($password ? ":{$password}" : '') . |
|
| 177 | - ($username ? '@' : '') . "{$host}" . |
|
| 178 | - ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]))->phpFastCache; |
|
| 175 | + ($username ?: '') . |
|
| 176 | + ($password ? ":{$password}" : '') . |
|
| 177 | + ($username ? '@' : '') . "{$host}" . |
|
| 178 | + ($port != '27017' ? ":{$port}" : ''), ['connectTimeoutMS' => $timeout * 1000]))->phpFastCache; |
|
| 179 | 179 | // $this->instance->Cache->createIndex([self::DRIVER_TIME_WRAPPER_INDEX => 1], ['expireAfterSeconds' => 0]); |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -201,25 +201,25 @@ discard block |
||
| 201 | 201 | public function getStats() |
| 202 | 202 | { |
| 203 | 203 | $serverStatus = $this->getCollection()->db->command([ |
| 204 | - 'serverStatus' => 1, |
|
| 205 | - 'recordStats' => 0, |
|
| 206 | - 'repl' => 0, |
|
| 207 | - 'metrics' => 0, |
|
| 204 | + 'serverStatus' => 1, |
|
| 205 | + 'recordStats' => 0, |
|
| 206 | + 'repl' => 0, |
|
| 207 | + 'metrics' => 0, |
|
| 208 | 208 | ]); |
| 209 | 209 | |
| 210 | 210 | $collStats = $this->getCollection()->db->command([ |
| 211 | - 'collStats' => 'Cache', |
|
| 212 | - 'verbose' => true, |
|
| 211 | + 'collStats' => 'Cache', |
|
| 212 | + 'verbose' => true, |
|
| 213 | 213 | ]); |
| 214 | 214 | |
| 215 | 215 | $stats = (new driverStatistic()) |
| 216 | - ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.") |
|
| 217 | - ->setSize((int) @$collStats[ 'size' ]) |
|
| 218 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 219 | - ->setRawData([ |
|
| 216 | + ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.") |
|
| 217 | + ->setSize((int) @$collStats[ 'size' ]) |
|
| 218 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 219 | + ->setRawData([ |
|
| 220 | 220 | 'serverStatus' => $serverStatus, |
| 221 | 221 | 'collStats' => $collStats, |
| 222 | - ]); |
|
| 222 | + ]); |
|
| 223 | 223 | |
| 224 | 224 | return $stats; |
| 225 | 225 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function driverCheck() |
| 64 | 64 | { |
| 65 | - if(class_exists('MongoDB\Driver\Manager')){ |
|
| 65 | + if (class_exists('MongoDB\Driver\Manager')) { |
|
| 66 | 66 | trigger_error('PhpFastCache currently only support the pecl Mongo extension.<br /> |
| 67 | 67 | The Support for the MongoDB extension will be added coming soon.', E_USER_ERROR); |
| 68 | 68 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | return false; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - return isset($result[ 'ok' ]) ? $result[ 'ok' ] == 1 : true; |
|
| 100 | + return isset($result['ok']) ? $result['ok'] == 1 : true; |
|
| 101 | 101 | } else { |
| 102 | 102 | throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
| 103 | 103 | } |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | if ($document) { |
| 117 | 117 | return [ |
| 118 | - self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_DATA_WRAPPER_INDEX ]->bin), |
|
| 119 | - self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[ self::DRIVER_EDATE_WRAPPER_INDEX ]->sec), |
|
| 120 | - self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[ self::DRIVER_TAGS_WRAPPER_INDEX ]->bin), |
|
| 118 | + self::DRIVER_DATA_WRAPPER_INDEX => $this->decode($document[self::DRIVER_DATA_WRAPPER_INDEX]->bin), |
|
| 119 | + self::DRIVER_EDATE_WRAPPER_INDEX => (new \DateTime())->setTimestamp($document[self::DRIVER_EDATE_WRAPPER_INDEX]->sec), |
|
| 120 | + self::DRIVER_TAGS_WRAPPER_INDEX => $this->decode($document[self::DRIVER_TAGS_WRAPPER_INDEX]->bin), |
|
| 121 | 121 | ]; |
| 122 | 122 | } else { |
| 123 | 123 | return null; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | if ($item instanceof Item) { |
| 138 | 138 | $deletionResult = (array) $this->getCollection()->remove(['_id' => $item->getKey()], ["w" => 1]); |
| 139 | 139 | |
| 140 | - return (int) $deletionResult[ 'ok' ] === 1 && !$deletionResult[ 'err' ]; |
|
| 140 | + return (int) $deletionResult['ok'] === 1 && !$deletionResult['err']; |
|
| 141 | 141 | } else { |
| 142 | 142 | throw new \InvalidArgumentException('Cross-Driver type confusion detected'); |
| 143 | 143 | } |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | if ($this->instance instanceof MongodbClient) { |
| 162 | 162 | throw new LogicException('Already connected to Mongodb server'); |
| 163 | 163 | } else { |
| 164 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 165 | - $port = isset($this->config[ 'port' ]) ? $this->config[ 'port' ] : '27017'; |
|
| 166 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : 3; |
|
| 167 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 168 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
| 164 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 165 | + $port = isset($this->config['port']) ? $this->config['port'] : '27017'; |
|
| 166 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 3; |
|
| 167 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 168 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | ]); |
| 214 | 214 | |
| 215 | 215 | $stats = (new driverStatistic()) |
| 216 | - ->setInfo('MongoDB version ' . $serverStatus[ 'version' ] . ', Uptime (in days): ' . round($serverStatus[ 'uptime' ] / 86400, 1) . "\n For more information see RawData.") |
|
| 217 | - ->setSize((int) @$collStats[ 'size' ]) |
|
| 216 | + ->setInfo('MongoDB version ' . $serverStatus['version'] . ', Uptime (in days): ' . round($serverStatus['uptime'] / 86400, 1) . "\n For more information see RawData.") |
|
| 217 | + ->setSize((int) @$collStats['size']) |
|
| 218 | 218 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 219 | 219 | ->setRawData([ |
| 220 | 220 | 'serverStatus' => $serverStatus, |
@@ -159,9 +159,9 @@ |
||
| 159 | 159 | $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
| 160 | 160 | |
| 161 | 161 | return (new driverStatistic()) |
| 162 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 163 | - ->setRawData($info) |
|
| 164 | - ->setSize($info[ 'used_memory' ]) |
|
| 165 | - ->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.", $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
| 162 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 163 | + ->setRawData($info) |
|
| 164 | + ->setSize($info[ 'used_memory' ]) |
|
| 165 | + ->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.", $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | \ No newline at end of file |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | } else { |
| 123 | 123 | $this->instance = $this->instance ?: new RedisClient(); |
| 124 | 124 | |
| 125 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 126 | - $port = isset($this->config[ 'port' ]) ? (int) $this->config[ 'port' ] : '6379'; |
|
| 127 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 128 | - $database = isset($this->config[ 'database' ]) ? $this->config[ 'database' ] : ''; |
|
| 129 | - $timeout = isset($this->config[ 'timeout' ]) ? $this->config[ 'timeout' ] : ''; |
|
| 125 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 126 | + $port = isset($this->config['port']) ? (int) $this->config['port'] : '6379'; |
|
| 127 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 128 | + $database = isset($this->config['database']) ? $this->config['database'] : ''; |
|
| 129 | + $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : ''; |
|
| 130 | 130 | |
| 131 | 131 | if (!$this->instance->connect($host, (int) $port, (int) $timeout)) { |
| 132 | 132 | return false; |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | { |
| 157 | 157 | // used_memory |
| 158 | 158 | $info = $this->instance->info(); |
| 159 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'uptime_in_seconds' ]); |
|
| 159 | + $date = (new \DateTime())->setTimestamp(time() - $info['uptime_in_seconds']); |
|
| 160 | 160 | |
| 161 | 161 | return (new driverStatistic()) |
| 162 | 162 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 163 | 163 | ->setRawData($info) |
| 164 | - ->setSize($info[ 'used_memory' ]) |
|
| 165 | - ->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.", $info[ 'redis_version' ], $date->format(DATE_RFC2822))); |
|
| 164 | + ->setSize($info['used_memory']) |
|
| 165 | + ->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.", $info['redis_version'], $date->format(DATE_RFC2822))); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | \ No newline at end of file |
@@ -136,9 +136,9 @@ |
||
| 136 | 136 | $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
| 137 | 137 | |
| 138 | 138 | return (new driverStatistic()) |
| 139 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 140 | - ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), $stats[ 'num_entries' ])) |
|
| 141 | - ->setRawData($stats) |
|
| 142 | - ->setSize($stats[ 'mem_size' ]); |
|
| 139 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 140 | + ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), $stats[ 'num_entries' ])) |
|
| 141 | + ->setRawData($stats) |
|
| 142 | + ->setSize($stats[ 'mem_size' ]); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | \ No newline at end of file |
@@ -133,12 +133,12 @@ |
||
| 133 | 133 | public function getStats() |
| 134 | 134 | { |
| 135 | 135 | $stats = (array) apc_cache_info('user'); |
| 136 | - $date = (new \DateTime())->setTimestamp($stats[ 'start_time' ]); |
|
| 136 | + $date = (new \DateTime())->setTimestamp($stats['start_time']); |
|
| 137 | 137 | |
| 138 | 138 | return (new driverStatistic()) |
| 139 | 139 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 140 | - ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), $stats[ 'num_entries' ])) |
|
| 140 | + ->setInfo(sprintf("The APCU cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), $stats['num_entries'])) |
|
| 141 | 141 | ->setRawData($stats) |
| 142 | - ->setSize($stats[ 'mem_size' ]); |
|
| 142 | + ->setSize($stats['mem_size']); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | \ No newline at end of file |
@@ -132,9 +132,9 @@ |
||
| 132 | 132 | $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]); |
| 133 | 133 | |
| 134 | 134 | return (new driverStatistic()) |
| 135 | - ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
| 136 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
| 137 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 138 | - ->setRawData($memInfo); |
|
| 135 | + ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
|
| 136 | + ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
| 137 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 138 | + ->setRawData($memInfo); |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | \ No newline at end of file |
@@ -129,11 +129,11 @@ |
||
| 129 | 129 | { |
| 130 | 130 | $memInfo = wincache_ucache_meminfo(); |
| 131 | 131 | $info = wincache_ucache_info(); |
| 132 | - $date = (new \DateTime())->setTimestamp(time() - $info[ 'total_cache_uptime' ]); |
|
| 132 | + $date = (new \DateTime())->setTimestamp(time() - $info['total_cache_uptime']); |
|
| 133 | 133 | |
| 134 | 134 | return (new driverStatistic()) |
| 135 | 135 | ->setInfo(sprintf("The Wincache daemon is up since %s.\n For more information see RawData.", $date->format(DATE_RFC2822))) |
| 136 | - ->setSize($memInfo[ 'memory_free' ] - $memInfo[ 'memory_total' ]) |
|
| 136 | + ->setSize($memInfo['memory_free'] - $memInfo['memory_total']) |
|
| 137 | 137 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 138 | 138 | ->setRawData($memInfo); |
| 139 | 139 | } |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
| 143 | 143 | $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
| 144 | 144 | $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
| 145 | - [ |
|
| 145 | + [ |
|
| 146 | 146 | 'bucket' => 'default', |
| 147 | 147 | 'password' => '', |
| 148 | - ], |
|
| 148 | + ], |
|
| 149 | 149 | ]; |
| 150 | 150 | |
| 151 | 151 | $this->instance = $this->instance ?: new CouchbaseClient("couchbase://{$host}", $username, $password); |
@@ -193,9 +193,9 @@ discard block |
||
| 193 | 193 | $info = $this->getBucket()->manager()->info(); |
| 194 | 194 | |
| 195 | 195 | return (new driverStatistic()) |
| 196 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 197 | - ->setRawData($info) |
|
| 198 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 199 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, 1) . "\n For more information see RawData."); |
|
| 196 | + ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 197 | + ->setRawData($info) |
|
| 198 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 199 | + ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, 1) . "\n For more information see RawData."); |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | \ No newline at end of file |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | } else { |
| 138 | 138 | |
| 139 | 139 | |
| 140 | - $host = isset($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1'; |
|
| 141 | - $password = isset($this->config[ 'password' ]) ? $this->config[ 'password' ] : ''; |
|
| 142 | - $username = isset($this->config[ 'username' ]) ? $this->config[ 'username' ] : ''; |
|
| 143 | - $buckets = isset($this->config[ 'buckets' ]) ? $this->config[ 'buckets' ] : [ |
|
| 140 | + $host = isset($this->config['host']) ? $this->config['host'] : '127.0.0.1'; |
|
| 141 | + $password = isset($this->config['password']) ? $this->config['password'] : ''; |
|
| 142 | + $username = isset($this->config['username']) ? $this->config['username'] : ''; |
|
| 143 | + $buckets = isset($this->config['buckets']) ? $this->config['buckets'] : [ |
|
| 144 | 144 | [ |
| 145 | 145 | 'bucket' => 'default', |
| 146 | 146 | 'password' => '', |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | $this->instance = new CouchbaseClient("couchbase://{$host}", $username, $password); |
| 151 | 151 | |
| 152 | 152 | foreach ($buckets as $bucket) { |
| 153 | - $this->bucketCurrent = $this->bucketCurrent ?: $bucket[ 'bucket' ]; |
|
| 154 | - $this->setBucket($bucket[ 'bucket' ], $this->instance->openBucket($bucket[ 'bucket' ], $bucket[ 'password' ])); |
|
| 153 | + $this->bucketCurrent = $this->bucketCurrent ?: $bucket['bucket']; |
|
| 154 | + $this->setBucket($bucket['bucket'], $this->instance->openBucket($bucket['bucket'], $bucket['password'])); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | protected function getBucket() |
| 165 | 165 | { |
| 166 | - return $this->bucketInstances[ $this->bucketCurrent ]; |
|
| 166 | + return $this->bucketInstances[$this->bucketCurrent]; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | protected function setBucket($bucketName, \CouchbaseBucket $CouchbaseBucket) |
| 175 | 175 | { |
| 176 | 176 | if (!array_key_exists($bucketName, $this->bucketInstances)) { |
| 177 | - $this->bucketInstances[ $bucketName ] = $CouchbaseBucket; |
|
| 177 | + $this->bucketInstances[$bucketName] = $CouchbaseBucket; |
|
| 178 | 178 | } else { |
| 179 | 179 | throw new \LogicException('A bucket instance with this name already exists.'); |
| 180 | 180 | } |
@@ -194,9 +194,9 @@ discard block |
||
| 194 | 194 | $info = $this->getBucket()->manager()->info(); |
| 195 | 195 | |
| 196 | 196 | return (new driverStatistic()) |
| 197 | - ->setSize($info[ 'basicStats' ][ 'diskUsed' ]) |
|
| 197 | + ->setSize($info['basicStats']['diskUsed']) |
|
| 198 | 198 | ->setRawData($info) |
| 199 | 199 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 200 | - ->setInfo('CouchBase version ' . $info[ 'nodes' ][ 0 ][ 'version' ] . ', Uptime (in days): ' . round($info[ 'nodes' ][ 0 ][ 'uptime' ] / 86400, 1) . "\n For more information see RawData."); |
|
| 200 | + ->setInfo('CouchBase version ' . $info['nodes'][0]['version'] . ', Uptime (in days): ' . round($info['nodes'][0]['uptime'] / 86400, 1) . "\n For more information see RawData."); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | \ No newline at end of file |
@@ -136,10 +136,10 @@ |
||
| 136 | 136 | $info = xcache_info(XC_TYPE_VAR, 0); |
| 137 | 137 | |
| 138 | 138 | return (new driverStatistic()) |
| 139 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
| 140 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 141 | - ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
|
| 142 | - ->setRawData($info); |
|
| 139 | + ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
| 140 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 141 | + ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
|
| 142 | + ->setRawData($info); |
|
| 143 | 143 | } else { |
| 144 | 144 | throw new \RuntimeException("PhpFastCache is not able to read Xcache configuration. Please put this to your php.ini:\n |
| 145 | 145 | [xcache.admin] |
@@ -136,7 +136,7 @@ |
||
| 136 | 136 | $info = xcache_info(XC_TYPE_VAR, 0); |
| 137 | 137 | |
| 138 | 138 | return (new driverStatistic()) |
| 139 | - ->setSize(abs($info[ 'size' ] - $info[ 'avail' ])) |
|
| 139 | + ->setSize(abs($info['size'] - $info['avail'])) |
|
| 140 | 140 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 141 | 141 | ->setInfo(sprintf("Xcache v%s with following modules loaded:\n %s", XCACHE_VERSION, str_replace(' ', ', ', XCACHE_MODULES))) |
| 142 | 142 | ->setRawData($info); |