Skip to content

Commit 51d756f

Browse files
authored
Merge pull request #351 from Geolim4/final
Fixed notice on Memcache driver when the server just started
2 parents c32d937 + d1cabb8 commit 51d756f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/phpFastCache/Drivers/Memcache/Driver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ protected function driverConnect()
161161
public function getStats()
162162
{
163163
$stats = (array) $this->instance->getstats();
164+
$stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0);
165+
$stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion');
166+
$stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0);
167+
164168
$date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
165169

166170
return (new driverStatistic())

src/phpFastCache/Drivers/Memcached/Driver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ protected function driverConnect()
160160
public function getStats()
161161
{
162162
$stats = (array) $this->instance->getStats();
163+
$stats[ 'uptime' ] = (isset($stats[ 'uptime' ]) ? $stats[ 'uptime' ] : 0);
164+
$stats[ 'version' ] = (isset($stats[ 'version' ]) ? $stats[ 'version' ] : 'UnknownVersion');
165+
$stats[ 'bytes' ] = (isset($stats[ 'bytes' ]) ? $stats[ 'version' ] : 0);
166+
163167
$date = (new \DateTime())->setTimestamp(time() - $stats[ 'uptime' ]);
164168

165169
return (new driverStatistic())

0 commit comments

Comments
 (0)