@@ 192-204 (lines=13) @@ | ||
189 | /** |
|
190 | * @return DriverStatistic |
|
191 | */ |
|
192 | public function getStats() |
|
193 | { |
|
194 | $info = $this->instance->info(); |
|
195 | $size = (isset($info[ 'Memory' ][ 'used_memory' ]) ? $info[ 'Memory' ][ 'used_memory' ] : 0); |
|
196 | $version = (isset($info[ 'Server' ][ 'redis_version' ]) ? $info[ 'Server' ][ 'redis_version' ] : 0); |
|
197 | $date = (isset($info[ 'Server' ][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info[ 'Server' ][ 'uptime_in_seconds' ]) : 'unknown date'); |
|
198 | ||
199 | return (new DriverStatistic()) |
|
200 | ->setData(implode(', ', array_keys($this->itemInstances))) |
|
201 | ->setRawData($info) |
|
202 | ->setSize($size) |
|
203 | ->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.", |
|
204 | $version, $date->format(DATE_RFC2822))); |
|
205 | } |
|
206 | } |
@@ 192-206 (lines=15) @@ | ||
189 | /** |
|
190 | * @return DriverStatistic |
|
191 | */ |
|
192 | public function getStats() |
|
193 | { |
|
194 | $stats = (array)$this->instance->getstats(); |
|
195 | $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
196 | $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion'); |
|
197 | $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
198 | ||
199 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
200 | ||
201 | return (new DriverStatistic()) |
|
202 | ->setData(implode(', ', array_keys($this->itemInstances))) |
|
203 | ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
204 | ->setRawData($stats) |
|
205 | ->setSize($stats[ 'bytes' ]); |
|
206 | } |
|
207 | } |
@@ 188-202 (lines=15) @@ | ||
185 | /** |
|
186 | * @return DriverStatistic |
|
187 | */ |
|
188 | public function getStats() |
|
189 | { |
|
190 | $stats = current($this->instance->getStats()); |
|
191 | $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
192 | $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : $this->instance->getVersion()); |
|
193 | $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
194 | ||
195 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
196 | ||
197 | return (new DriverStatistic()) |
|
198 | ->setData(implode(', ', array_keys($this->itemInstances))) |
|
199 | ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
200 | ->setRawData($stats) |
|
201 | ->setSize($stats[ 'bytes' ]); |
|
202 | } |
|
203 | } |