@@ -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) |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | namespace phpFastCache\Drivers\Wincache; |
| 16 | 16 | |
| 17 | 17 | use phpFastCache\Core\DriverAbstract; |
| 18 | -use phpFastCache\Core\StandardPsr6StructureTrait; |
|
| 19 | 18 | use phpFastCache\Entities\driverStatistic; |
| 20 | 19 | use phpFastCache\Exceptions\phpFastCacheDriverCheckException; |
| 21 | 20 | use phpFastCache\Exceptions\phpFastCacheDriverException; |
@@ -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($server[ 'port' ]) ? $server[ 'port' ] : '27017'; |
|
| 166 | - $timeout = isset($server[ 'timeout' ]) ? $server[ '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($server['port']) ? $server['port'] : '27017'; |
|
| 166 | + $timeout = isset($server['timeout']) ? $server['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, |
@@ -23,10 +23,10 @@ |
||
| 23 | 23 | if (!is_object($driverInstance)) { |
| 24 | 24 | echo '[FAIL] CacheManager::getInstance() returned an invalid variable type:' . gettype($driverInstance) . "\n"; |
| 25 | 25 | $status = 1; |
| 26 | -}else if(!($driverInstance instanceof CacheItemPoolInterface)){ |
|
| 26 | +} else if (!($driverInstance instanceof CacheItemPoolInterface)) { |
|
| 27 | 27 | echo '[FAIL] CacheManager::getInstance() returned an invalid class:' . get_class($driverInstance) . "\n"; |
| 28 | 28 | $status = 1; |
| 29 | -}else{ |
|
| 29 | +} else { |
|
| 30 | 30 | echo '[PASS] CacheManager::getInstance() returned a valid CacheItemPoolInterface object: ' . get_class($driverInstance) . "\n"; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -23,10 +23,10 @@ |
||
| 23 | 23 | if (!is_object($driverInstance)) { |
| 24 | 24 | echo '[FAIL] CacheManager::getInstance() returned an invalid variable type:' . gettype($driverInstance) . "\n"; |
| 25 | 25 | $status = 1; |
| 26 | -}else if(!($driverInstance instanceof CacheItemPoolInterface)){ |
|
| 26 | +} else if(!($driverInstance instanceof CacheItemPoolInterface)){ |
|
| 27 | 27 | echo '[FAIL] CacheManager::getInstance() returned an invalid class:' . get_class($driverInstance) . "\n"; |
| 28 | 28 | $status = 1; |
| 29 | -}else{ |
|
| 29 | +} else{ |
|
| 30 | 30 | echo '[PASS] CacheManager::getInstance() returned a valid CacheItemPoolInterface object: ' . get_class($driverInstance) . "\n"; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -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 |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | protected function driverConnect() |
| 129 | 129 | { |
| 130 | - $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []); |
|
| 130 | + $servers = (!empty($this->config['memcache']) && is_array($this->config['memcache']) ? $this->config['memcache'] : []); |
|
| 131 | 131 | if (count($servers) < 1) { |
| 132 | 132 | $servers = [ |
| 133 | 133 | ['127.0.0.1', 11211], |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | foreach ($servers as $server) { |
| 138 | 138 | try { |
| 139 | - if (!$this->instance->addServer($server[ 0 ], $server[ 1 ])) { |
|
| 139 | + if (!$this->instance->addServer($server[0], $server[1])) { |
|
| 140 | 140 | $this->fallback = true; |
| 141 | 141 | } |
| 142 | 142 | } catch (\Exception $e) { |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | public function getStats() |
| 158 | 158 | { |
| 159 | 159 | $stats = (array) $this->instance->getStats(); |
| 160 | - $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
| 160 | + $date = (new \DateTime())->setTimestamp(time() - $stats['uptime']); |
|
| 161 | 161 | |
| 162 | 162 | return (new driverStatistic()) |
| 163 | 163 | ->setData(implode(', ', array_keys($this->itemInstances))) |
| 164 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 164 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats['version'], $date->format(DATE_RFC2822))) |
|
| 165 | 165 | ->setRawData($stats) |
| 166 | - ->setSize($stats[ 'bytes' ]); |
|
| 166 | + ->setSize($stats['bytes']); |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | \ No newline at end of file |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []); |
| 132 | 132 | if (count($servers) < 1) { |
| 133 | 133 | $servers = [ |
| 134 | - ['127.0.0.1', 11211], |
|
| 134 | + ['127.0.0.1', 11211], |
|
| 135 | 135 | ]; |
| 136 | 136 | } |
| 137 | 137 | |
@@ -161,9 +161,9 @@ discard block |
||
| 161 | 161 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
| 162 | 162 | |
| 163 | 163 | return (new driverStatistic()) |
| 164 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 165 | - ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 166 | - ->setRawData($stats) |
|
| 167 | - ->setSize($stats[ 'bytes' ]); |
|
| 164 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 165 | + ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 166 | + ->setRawData($stats) |
|
| 167 | + ->setSize($stats[ 'bytes' ]); |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | \ 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 | } |
@@ -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); |
@@ -136,10 +136,10 @@ |
||
| 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 APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
|
| 139 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 140 | + ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
|
| 141 | 141 | $stats[ 'num_entries' ])) |
| 142 | - ->setRawData($stats) |
|
| 143 | - ->setSize($stats[ 'mem_size' ]); |
|
| 142 | + ->setRawData($stats) |
|
| 143 | + ->setSize($stats[ 'mem_size' ]); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | \ No newline at end of file |
@@ -133,13 +133,13 @@ |
||
| 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 | 140 | ->setInfo(sprintf("The APC cache is up since %s, and have %d item(s) in cache.\n For more information see RawData.", $date->format(DATE_RFC2822), |
| 141 | - $stats[ 'num_entries' ])) |
|
| 141 | + $stats['num_entries'])) |
|
| 142 | 142 | ->setRawData($stats) |
| 143 | - ->setSize($stats[ 'mem_size' ]); |
|
| 143 | + ->setSize($stats['mem_size']); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | \ No newline at end of file |