Improve cache
This commit is contained in:
parent
05cc9ee0ce
commit
cb0637d524
1 changed files with 3 additions and 1 deletions
|
@ -23,8 +23,10 @@ class EmbedCache
|
|||
$info = null;
|
||||
$identifier = md5($url);
|
||||
$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));
|
||||
} else {
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue