Reduce cache time for OEmbed error

pull/5452/head
Hypolite Petovan 2018-07-24 11:05:09 -04:00
parent b6e3da8443
commit 6771522167
1 changed files with 5 additions and 1 deletions

View File

@ -112,6 +112,7 @@ class OEmbed
}
$oembed->parseJSON($json_string);
if (!empty($oembed->type) && $oembed->type != 'error') {
DBA::insert('oembed', [
'url' => normalise_link($embedurl),
@ -119,9 +120,12 @@ class OEmbed
'content' => $json_string,
'created' => DateTimeFormat::utcNow()
], 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') {