Skip to content

Commit

Permalink
Do not save if cache has already expired when being set
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Hall committed Jan 11, 2018
1 parent 73d1e26 commit 64c5110
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 @@ -70,6 +70,11 @@ public function set($key, $content, $expiry = 0)
$cacheObj->expiryTimestamp = time() + $expiry;
}

// Do not save if cache has already expired
if ($cacheObj->expiryTimestamp < time()) {
return false;
}

$cacheFileData = json_encode($cacheObj);

if ($this->config['gzipCompression']) {
Expand Down

0 comments on commit 64c5110

Please sign in to comment.