Reduce cache time for OEmbed error
This commit is contained in:
parent
b6e3da8443
commit
6771522167
1 changed files with 5 additions and 1 deletions
|
@ -112,6 +112,7 @@ class OEmbed
|
||||||
}
|
}
|
||||||
|
|
||||||
$oembed->parseJSON($json_string);
|
$oembed->parseJSON($json_string);
|
||||||
|
|
||||||
if (!empty($oembed->type) && $oembed->type != 'error') {
|
if (!empty($oembed->type) && $oembed->type != 'error') {
|
||||||
DBA::insert('oembed', [
|
DBA::insert('oembed', [
|
||||||
'url' => normalise_link($embedurl),
|
'url' => normalise_link($embedurl),
|
||||||
|
@ -119,9 +120,12 @@ class OEmbed
|
||||||
'content' => $json_string,
|
'content' => $json_string,
|
||||||
'created' => DateTimeFormat::utcNow()
|
'created' => DateTimeFormat::utcNow()
|
||||||
], true);
|
], true);
|
||||||
|
$cache_ttl = CACHE_DAY;
|
||||||
|
} else {
|
||||||
|
$cache_ttl = CACHE_FIVE_MINUTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache::set($cache_key, $json_string, CACHE_DAY);
|
Cache::set($cache_key, $json_string, $cache_ttl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oembed->type == 'error') {
|
if ($oembed->type == 'error') {
|
||||||
|
|
Loading…
Reference in a new issue