]> git.mxchange.org Git - friendica.git/commitdiff
Hash the URL before using it as cache key in Util\Images::getInfoFromURLCached
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 15 Feb 2022 21:10:15 +0000 (16:10 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 18 Feb 2022 14:19:36 +0000 (09:19 -0500)
- This prevents oversized URL from stunting the database cache

src/Util/Images.php

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