Skip to content

Commit

Permalink
Fix to prevent issues if compression is turned off while compressed c…
Browse files Browse the repository at this point in the history
…aches still exist
  • Loading branch information
Jordan Hall committed Mar 13, 2017
1 parent 8ec1835 commit cd7d308
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/RWFileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ public function get($key)

$cacheObj = json_decode($cacheFileData);

// Unable to decode JSON (could happen if compression was turned off while compressed caches still exist)
if ($cacheObj===false) {
return false;
}

$unixLoad = sys_getloadavg();

if ($cacheObj->expiryTimestamp > time() || $unixLoad[0] >= $this->config['unixLoadUpperThreshold']) {
Expand Down

0 comments on commit cd7d308

Please sign in to comment.