]> git.mxchange.org Git - friendica.git/commitdiff
Use negative caching
authorMichael <heluecht@pirati.ca>
Thu, 28 Jul 2022 20:25:38 +0000 (20:25 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 28 Jul 2022 20:25:38 +0000 (20:25 +0000)
src/Protocol/ActivityPub/Processor.php

index bfff5f84bb972d479842462b9e683b6091d11287..3b31e6d3c4bd5c5168da74700f4e5161290fd541 100644 (file)
@@ -1207,13 +1207,19 @@ class Processor
                $object = DI::cache()->get($cachekey);
 
                if (!is_null($object)) {
-                       Logger::debug('Fetch from cache', ['url' => $url, 'uid' => $uid]);
+                       if (!empty($object)) {
+                               Logger::debug('Fetch from cache', ['url' => $url, 'uid' => $uid]);
+                       } else {
+                               Logger::debug('Fetch from negative cache', ['url' => $url, 'uid' => $uid]);
+                       }
                        return $object;
                }
 
                $object = ActivityPub::fetchContent($url, $uid);
                if (empty($object)) {
                        Logger::notice('Activity was not fetchable, aborting.', ['url' => $url, 'uid' => $uid]);
+                       // We perform negative caching.
+                       DI::cache()->set($cachekey, [], Duration::FIVE_MINUTES);
                        return [];
                }