Fix refresh using cache

This commit is contained in:
grandeljay 2022-02-23 18:24:31 +01:00
parent fffe2a06fc
commit b0076f4aa6

View file

@ -24,13 +24,13 @@ class EmbedCache
$this->filepath = $this->directory . '/' . $this->identifier;
}
public function get(bool $generateCache = true): mixed
public function get(bool $generateCache = false): mixed
{
$info = null;
$maxAge = 2592000; // 30 days
$age = file_exists($this->filepath) ? time() - filemtime($this->filepath) : $maxAge;
if ($this->exists() && $age <= $maxAge) {
if ($this->exists() && $age <= $maxAge && false === $generateCache) {
$info = json_decode(file_get_contents($this->filepath));
} else {
/**