diff --git a/mod/ping.php b/mod/ping.php index 9593d6ed26..d00d0988a9 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -197,7 +197,7 @@ function ping_init(App $a) } $cachekey = "ping_init:".local_user(); - $ev = Cache::get($cachekey); + $ev = DI::cache()->get($cachekey); if (is_null($ev)) { $ev = q( "SELECT type, start, adjust FROM `event` diff --git a/mod/poco.php b/mod/poco.php index cbee264585..b21dbf3135 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -256,7 +256,7 @@ function poco_init(App $a) { if (isset($contact['account-type'])) { $contact['contact-type'] = $contact['account-type']; } - $about = Cache::get("about:" . $contact['updated'] . ":" . $contact['nurl']); + $about = DI::cache()->get("about:" . $contact['updated'] . ":" . $contact['nurl']); if (is_null($about)) { $about = BBCode::convert($contact['about'], false); DI::cache()->set("about:" . $contact['updated'] . ":" . $contact['nurl'], $about); diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index 51918283e0..6c62d6cfd8 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -66,7 +66,7 @@ class OEmbed if (DBA::isResult($oembed_record)) { $json_string = $oembed_record['content']; } else { - $json_string = Cache::get($cache_key); + $json_string = DI::cache()->get($cache_key); } // These media files should now be caught in bbcode.php diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 1489ed232f..63e9c55dcb 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1070,7 +1070,7 @@ class BBCode private static function removePictureLinksCallback($match) { $cache_key = 'remove:' . $match[1]; - $text = Cache::get($cache_key); + $text = DI::cache()->get($cache_key); if (is_null($text)) { $a = DI::app(); @@ -1143,7 +1143,7 @@ class BBCode } $cache_key = 'clean:' . $match[1]; - $text = Cache::get($cache_key); + $text = DI::cache()->get($cache_key); if (!is_null($text)) { return $text; } diff --git a/src/Core/Cache.php b/src/Core/Cache.php index 410f9fea18..4d5d8f087c 100644 --- a/src/Core/Cache.php +++ b/src/Core/Cache.php @@ -30,17 +30,4 @@ class Cache const MINUTE = CacheClass::MINUTE; /** @deprecated Use CacheClass::INFINITE */ const INFINITE = CacheClass::INFINITE; - - /** - * @brief Fetch cached data according to the key - * - * @param string $key The key to the cached data - * - * @return mixed Cached $value or "null" if not found - * @throws \Exception - */ - public static function get($key) - { - return DI::cache()->get($key); - } } diff --git a/src/Model/Photo.php b/src/Model/Photo.php index 0d05d81d0d..df4d50dd3d 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -546,7 +546,7 @@ class Photo $sql_extra = Security::getPermissionsSQLByUserId($uid); $key = "photo_albums:".$uid.":".local_user().":".remote_user(); - $albums = Cache::get($key); + $albums = DI::cache()->get($key); if (is_null($albums) || $update) { if (!Config::get("system", "no_count", false)) { /// @todo This query needs to be renewed. It is really slow diff --git a/src/Model/Profile.php b/src/Model/Profile.php index a5619c999b..f9bb5d27a5 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -586,7 +586,7 @@ class Profile $bd_short = L10n::t('F d'); $cachekey = 'get_birthdays:' . local_user(); - $r = Cache::get($cachekey); + $r = DI::cache()->get($cachekey); if (is_null($r)) { $s = DBA::p( "SELECT `event`.*, `event`.`id` AS `eid`, `contact`.* FROM `event` @@ -1066,7 +1066,7 @@ class Profile // Avoid endless loops $cachekey = 'zrlInit:' . $my_url; - if (Cache::get($cachekey)) { + if (DI::cache()->get($cachekey)) { Logger::log('URL ' . $my_url . ' already tried to authenticate.', Logger::DEBUG); return; } else { diff --git a/src/Model/Term.php b/src/Model/Term.php index 4eca9639ff..077df7386d 100644 --- a/src/Model/Term.php +++ b/src/Model/Term.php @@ -57,7 +57,7 @@ class Term */ public static function getGlobalTrendingHashtags(int $period, $limit = 10) { - $tags = Cache::get('global_trending_tags'); + $tags = DI::cache()->get('global_trending_tags'); if (!$tags) { $tagsStmt = DBA::p("SELECT t.`term`, COUNT(*) AS `score` @@ -100,7 +100,7 @@ class Term */ public static function getLocalTrendingHashtags(int $period, $limit = 10) { - $tags = Cache::get('local_trending_tags'); + $tags = DI::cache()->get('local_trending_tags'); if (!$tags) { $tagsStmt = DBA::p("SELECT t.`term`, COUNT(*) AS `score` diff --git a/src/Module/Search/Index.php b/src/Module/Search/Index.php index 776b3fced9..3cf06ede73 100644 --- a/src/Module/Search/Index.php +++ b/src/Module/Search/Index.php @@ -53,7 +53,7 @@ class Index extends BaseSearchModule $crawl_permit_period = 10; $remote = $_SERVER['REMOTE_ADDR']; - $result = Cache::get('remote_search:' . $remote); + $result = DI::cache()->get('remote_search:' . $remote); if (!is_null($result)) { $resultdata = json_decode($result); if (($resultdata->time > (time() - $crawl_permit_period)) && ($resultdata->accesses > $free_crawls)) { diff --git a/src/Network/Probe.php b/src/Network/Probe.php index c3279cd9d2..0516077105 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -332,7 +332,7 @@ class Probe public static function uri($uri, $network = '', $uid = -1, $cache = true) { if ($cache) { - $result = Cache::get('Probe::uri:' . $network . ':' . $uri); + $result = DI::cache()->get('Probe::uri:' . $network . ':' . $uri); if (!is_null($result)) { return $result; } diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 9a2b584fe3..144ce97319 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -819,7 +819,7 @@ class Transmitter $cachekey = 'APDelivery:createActivity:' . $item_id; if (!$force) { - $data = Cache::get($cachekey); + $data = DI::cache()->get($cachekey); if (!is_null($data)) { return $data; } diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 2d94e96c22..db3c80f492 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -3246,7 +3246,7 @@ class Diaspora $cachekey = "diaspora:sendParticipation:".$item['guid']; - $result = Cache::get($cachekey); + $result = DI::cache()->get($cachekey); if (!is_null($result)) { return; } @@ -3524,7 +3524,7 @@ class Diaspora { $cachekey = "diaspora:buildStatus:".$item['guid']; - $result = Cache::get($cachekey); + $result = DI::cache()->get($cachekey); if (!is_null($result)) { return $result; } @@ -3749,7 +3749,7 @@ class Diaspora { $cachekey = "diaspora:constructComment:".$item['guid']; - $result = Cache::get($cachekey); + $result = DI::cache()->get($cachekey); if (!is_null($result)) { return $result; } diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 38936762e0..04d349be0f 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -2185,7 +2185,7 @@ class OStatus // Don't cache when the last item was posted less then 15 minutes ago (Cache duration) if ((time() - strtotime($owner['last-item'])) < 15*60) { - $result = Cache::get($cachekey); + $result = DI::cache()->get($cachekey); if (!$nocache && !is_null($result)) { Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created . ' (cached)', Logger::DEBUG); $last_update = $result['last_update']; diff --git a/src/Util/Images.php b/src/Util/Images.php index b557d891d8..0118689442 100644 --- a/src/Util/Images.php +++ b/src/Util/Images.php @@ -125,7 +125,7 @@ class Images return $data; } - $data = Cache::get($url); + $data = DI::cache()->get($url); if (empty($data) || !is_array($data)) { $data = self::getInfoFromURL($url); diff --git a/src/Util/JsonLD.php b/src/Util/JsonLD.php index 598898c0e8..4a5836068d 100644 --- a/src/Util/JsonLD.php +++ b/src/Util/JsonLD.php @@ -40,7 +40,7 @@ class JsonLD exit(); } - $result = Cache::get('documentLoader:' . $url); + $result = DI::cache()->get('documentLoader:' . $url); if (!is_null($result)) { return $result; } diff --git a/src/Worker/SearchDirectory.php b/src/Worker/SearchDirectory.php index fcac721dfd..4d3087a70f 100644 --- a/src/Worker/SearchDirectory.php +++ b/src/Worker/SearchDirectory.php @@ -27,7 +27,7 @@ class SearchDirectory return; } - $data = Cache::get('SearchDirectory:' . $search); + $data = DI::cache()->get('SearchDirectory:' . $search); if (!is_null($data)) { // Only search for the same item every 24 hours if (time() < $data + (60 * 60 * 24)) {