Skip to content

Commit 5214c32

Browse files
authored
Merge pull request #334 from Geolim4/final
Fixed issue with Predis stats
2 parents 1513dc3 + 5a4604e commit 5214c32

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/phpFastCache/Drivers/Predis/Driver.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,15 @@ protected function driverConnect()
176176
*/
177177
public function getStats()
178178
{
179+
$info = $this->instance->info();
180+
$size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0);
181+
$version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0);
182+
$date = (isset($info['Server'][ 'uptime_in_seconds' ]) ? (new \DateTime())->setTimestamp(time() - $info['Server'][ 'uptime_in_seconds' ]) : 'unknown date');
183+
179184
return (new driverStatistic())
185+
->setData(implode(', ', array_keys($this->itemInstances)))
180186
->setRawData($this->instance->info())
181-
->setSize(0)
182-
->setInfo('');
187+
->setSize($size)
188+
->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)));
183189
}
184190
}

0 commit comments

Comments
 (0)