Hash the URL before using it as cache key in Util\Images::getInfoFromURLCached

- This prevents oversized URL from stunting the database cache
This commit is contained in:
Hypolite Petovan 2022-02-15 16:10:15 -05:00
parent 361fdccdc7
commit 17d49422b4

View File

@ -184,12 +184,14 @@ class Images
return $data; return $data;
} }
$data = DI::cache()->get($url); $cacheKey = 'getInfoFromURL:' . sha1($url);
$data = DI::cache()->get($cacheKey);
if (empty($data) || !is_array($data)) { if (empty($data) || !is_array($data)) {
$data = self::getInfoFromURL($url); $data = self::getInfoFromURL($url);
DI::cache()->set($url, $data); DI::cache()->set($cacheKey, $data);
} }
return $data; return $data;