From 64c511036a6885e23ef7efe3883934e5d7ae45b5 Mon Sep 17 00:00:00 2001 From: Jordan Hall Date: Thu, 11 Jan 2018 13:09:50 +0000 Subject: [PATCH] Do not save if cache has already expired when being set --- src/RWFileCache.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/RWFileCache.php b/src/RWFileCache.php index 04d7299..ba984df 100644 --- a/src/RWFileCache.php +++ b/src/RWFileCache.php @@ -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']) {