@@ -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 | |
@@ -176,9 +176,9 @@ |
||
| 176 | 176 | public function getStats() |
| 177 | 177 | { |
| 178 | 178 | return (new driverStatistic()) |
| 179 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 180 | - ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($this->getLeveldbFile())) |
|
| 181 | - ->setSize(Directory::dirSize($this->getLeveldbFile())); |
|
| 179 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 180 | + ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($this->getLeveldbFile())) |
|
| 181 | + ->setSize(Directory::dirSize($this->getLeveldbFile())); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -254,9 +254,9 @@ |
||
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | $stat->setData(implode(', ', array_keys($this->itemInstances))) |
| 257 | - ->setRawData([]) |
|
| 258 | - ->setSize(Directory::dirSize($path)) |
|
| 259 | - ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
| 257 | + ->setRawData([]) |
|
| 258 | + ->setSize(Directory::dirSize($path)) |
|
| 259 | + ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
| 260 | 260 | |
| 261 | 261 | return $stat; |
| 262 | 262 | } |
@@ -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) { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | $PDO = new PDO("sqlite:" . $this->SqliteDir . '/' . self::INDEXING_FILE); |
| 153 | 153 | $PDO->setAttribute(PDO::ATTR_ERRMODE, |
| 154 | - PDO::ERRMODE_EXCEPTION); |
|
| 154 | + PDO::ERRMODE_EXCEPTION); |
|
| 155 | 155 | |
| 156 | 156 | if ($createTable == true) { |
| 157 | 157 | $this->initIndexing($PDO); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | // look for keyword |
| 187 | 187 | $stm = $this->indexing->prepare("SELECT * FROM `balancing` WHERE `keyword`=:keyword LIMIT 1"); |
| 188 | 188 | $stm->execute([ |
| 189 | - ':keyword' => $keyword, |
|
| 189 | + ':keyword' => $keyword, |
|
| 190 | 190 | ]); |
| 191 | 191 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 192 | 192 | if (isset($row[ 'db' ]) && $row[ 'db' ] != '') { |
@@ -198,8 +198,8 @@ discard block |
||
| 198 | 198 | $db = $this->currentDB; |
| 199 | 199 | $stm = $this->indexing->prepare("INSERT INTO `balancing` (`keyword`,`db`) VALUES(:keyword, :db)"); |
| 200 | 200 | $stm->execute([ |
| 201 | - ':keyword' => $keyword, |
|
| 202 | - ':db' => $db, |
|
| 201 | + ':keyword' => $keyword, |
|
| 202 | + ':db' => $db, |
|
| 203 | 203 | ]); |
| 204 | 204 | } |
| 205 | 205 | |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | if ($toWrite == true) { |
| 271 | 271 | try { |
| 272 | 272 | $stm = $this->getDb($item->getKey()) |
| 273 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 273 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 274 | 274 | $stm->execute([ |
| 275 | - ':keyword' => $item->getKey(), |
|
| 276 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 277 | - ':exp' => time() + $item->getTtl(), |
|
| 275 | + ':keyword' => $item->getKey(), |
|
| 276 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 277 | + ':exp' => time() + $item->getTtl(), |
|
| 278 | 278 | ]); |
| 279 | 279 | |
| 280 | 280 | return true; |
@@ -282,11 +282,11 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | try { |
| 284 | 284 | $stm = $this->getDb($item->getKey(), true) |
| 285 | - ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 285 | + ->prepare("INSERT OR REPLACE INTO `caching` (`keyword`,`object`,`exp`) values(:keyword,:object,:exp)"); |
|
| 286 | 286 | $stm->execute([ |
| 287 | - ':keyword' => $item->getKey(), |
|
| 288 | - ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 289 | - ':exp' => time() + $item->getTtl(), |
|
| 287 | + ':keyword' => $item->getKey(), |
|
| 288 | + ':object' => $this->encode($this->driverPreWrap($item)), |
|
| 289 | + ':exp' => time() + $item->getTtl(), |
|
| 290 | 290 | ]); |
| 291 | 291 | } catch (PDOException $e) { |
| 292 | 292 | return false; |
@@ -308,20 +308,20 @@ discard block |
||
| 308 | 308 | { |
| 309 | 309 | try { |
| 310 | 310 | $stm = $this->getDb($item->getKey()) |
| 311 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
| 311 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
| 312 | 312 | $stm->execute([ |
| 313 | - ':keyword' => $item->getKey(), |
|
| 314 | - ':U' => time(), |
|
| 313 | + ':keyword' => $item->getKey(), |
|
| 314 | + ':U' => time(), |
|
| 315 | 315 | ]); |
| 316 | 316 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 317 | 317 | |
| 318 | 318 | } catch (PDOException $e) { |
| 319 | 319 | try { |
| 320 | 320 | $stm = $this->getDb($item->getKey(), true) |
| 321 | - ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
| 321 | + ->prepare("SELECT * FROM `caching` WHERE `keyword`=:keyword AND (`exp` >= :U) LIMIT 1"); |
|
| 322 | 322 | $stm->execute([ |
| 323 | - ':keyword' => $item->getKey(), |
|
| 324 | - ':U' => time(), |
|
| 323 | + ':keyword' => $item->getKey(), |
|
| 324 | + ':U' => time(), |
|
| 325 | 325 | ]); |
| 326 | 326 | $row = $stm->fetch(PDO::FETCH_ASSOC); |
| 327 | 327 | } catch (PDOException $e) { |
@@ -359,13 +359,13 @@ discard block |
||
| 359 | 359 | if ($item instanceof Item) { |
| 360 | 360 | try { |
| 361 | 361 | $stm = $this->getDb($item->getKey()) |
| 362 | - //->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) "); |
|
| 363 | - ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
| 362 | + //->prepare("DELETE FROM `caching` WHERE (`id`=:id) OR (`exp` <= :U) "); |
|
| 363 | + ->prepare("DELETE FROM `caching` WHERE (`exp` <= :U) OR (`keyword`=:keyword) "); |
|
| 364 | 364 | |
| 365 | 365 | return $stm->execute([ |
| 366 | 366 | // ':id' => $row[ 'id' ], |
| 367 | - ':keyword' => $item->getKey(), |
|
| 368 | - ':U' => time(), |
|
| 367 | + ':keyword' => $item->getKey(), |
|
| 368 | + ':U' => time(), |
|
| 369 | 369 | ]); |
| 370 | 370 | } catch (PDOException $e) { |
| 371 | 371 | return false; |
@@ -428,9 +428,9 @@ discard block |
||
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | $stat->setData(implode(', ', array_keys($this->itemInstances))) |
| 431 | - ->setRawData([]) |
|
| 432 | - ->setSize(Directory::dirSize($path)) |
|
| 433 | - ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
| 431 | + ->setRawData([]) |
|
| 432 | + ->setSize(Directory::dirSize($path)) |
|
| 433 | + ->setInfo('Number of files used to build the cache: ' . Directory::getFileCount($path)); |
|
| 434 | 434 | |
| 435 | 435 | return $stat; |
| 436 | 436 | } |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |