diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/BridgeAbstract.php | 8 | ||||
-rw-r--r-- | lib/CacheInterface.php | 8 | ||||
-rw-r--r-- | lib/contents.php | 4 |
3 files changed, 13 insertions, 7 deletions
diff --git a/lib/BridgeAbstract.php b/lib/BridgeAbstract.php index ddc1f175..537e76df 100644 --- a/lib/BridgeAbstract.php +++ b/lib/BridgeAbstract.php @@ -423,7 +423,13 @@ abstract class BridgeAbstract implements BridgeInterface $scope = $this->getShortName(); $cache->setScope($scope); $cache->setKey($key); - if ($duration && $cache->getTime() < time() - $duration) { + $timestamp = $cache->getTime(); + + if ( + $duration + && $timestamp + && $timestamp < time() - $duration + ) { return null; } return $cache->loadData(); diff --git a/lib/CacheInterface.php b/lib/CacheInterface.php index 1c3b89ca..b332e21b 100644 --- a/lib/CacheInterface.php +++ b/lib/CacheInterface.php @@ -53,11 +53,11 @@ interface CacheInterface public function saveData($data); /** - * Returns the timestamp for the curent cache data - * - * @return ?int Timestamp + * Returns the modification time of the current cache item. + * In unix timestamp. + * Example: 1688570578 */ - public function getTime(); + public function getTime(): ?int; /** * Removes any data that is older than the specified age from cache diff --git a/lib/contents.php b/lib/contents.php index 3fbaa620..568d5b92 100644 --- a/lib/contents.php +++ b/lib/contents.php @@ -432,8 +432,8 @@ function getSimpleHTMLDOMCached( // Determine if cached file is within duration $time = $cache->getTime(); if ( - $time !== false - && (time() - $duration < $time) + $time + && time() - $duration < $time && !Debug::isEnabled() ) { // Contents within duration and debug mode is disabled |