Improve cache

This commit is contained in:
Jay Trees 2022-02-22 13:06:42 +01:00
parent 05cc9ee0ce
commit cb0637d524

View file

@ -23,8 +23,10 @@ class EmbedCache
$info = null; $info = null;
$identifier = md5($url); $identifier = md5($url);
$filepath = $this->directory . '/' . $identifier; $filepath = $this->directory . '/' . $identifier;
$age = time() - filemtime($filepath);
$maxAge = 2592000; // 30 days
if (file_exists($filepath)) { if (file_exists($filepath) && $age <= $maxAge) {
$info = json_decode(file_get_contents($filepath)); $info = json_decode(file_get_contents($filepath));
} else { } else {
/** /**