| @@ 167-181 (lines=15) @@ | ||
| 164 | /** |
|
| 165 | * @return DriverStatistic |
|
| 166 | */ |
|
| 167 | public function getStats() |
|
| 168 | { |
|
| 169 | $stats = (array) $this->instance->getstats(); |
|
| 170 | $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
| 171 | $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion'); |
|
| 172 | $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
| 173 | ||
| 174 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
| 175 | ||
| 176 | return (new DriverStatistic()) |
|
| 177 | ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 178 | ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 179 | ->setRawData($stats) |
|
| 180 | ->setSize($stats[ 'bytes' ]); |
|
| 181 | } |
|
| 182 | } |
|
| @@ 166-180 (lines=15) @@ | ||
| 163 | /** |
|
| 164 | * @return DriverStatistic |
|
| 165 | */ |
|
| 166 | public function getStats() |
|
| 167 | { |
|
| 168 | $stats = (array) $this->instance->getStats(); |
|
| 169 | $stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0); |
|
| 170 | $stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion'); |
|
| 171 | $stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0); |
|
| 172 | ||
| 173 | $date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]); |
|
| 174 | ||
| 175 | return (new DriverStatistic()) |
|
| 176 | ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 177 | ->setInfo(sprintf("The memcache daemon v%s is up since %s.\n For more information see RawData.", $stats[ 'version' ], $date->format(DATE_RFC2822))) |
|
| 178 | ->setRawData($stats) |
|
| 179 | ->setSize($stats[ 'bytes' ]); |
|
| 180 | } |
|
| 181 | } |
|
| @@ 161-173 (lines=13) @@ | ||
| 158 | /** |
|
| 159 | * @return DriverStatistic |
|
| 160 | */ |
|
| 161 | public function getStats() |
|
| 162 | { |
|
| 163 | $info = $this->instance->info(); |
|
| 164 | $size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0); |
|
| 165 | $version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0); |
|
| 166 | $date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date'); |
|
| 167 | ||
| 168 | return (new DriverStatistic()) |
|
| 169 | ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 170 | ->setRawData($info) |
|
| 171 | ->setSize($size) |
|
| 172 | ->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.", $version, $date->format(DATE_RFC2822))); |
|
| 173 | } |
|
| 174 | } |
|