]> git.mxchange.org Git - friendica.git/commitdiff
Move Cache::get() to DI::cache()->get()
authornupplaPhil <admin@philipp.info>
Mon, 6 Jan 2020 23:45:49 +0000 (00:45 +0100)
committernupplaPhil <admin@philipp.info>
Mon, 6 Jan 2020 23:45:49 +0000 (00:45 +0100)
16 files changed:
mod/ping.php
mod/poco.php
src/Content/OEmbed.php
src/Content/Text/BBCode.php
src/Core/Cache.php
src/Model/Photo.php
src/Model/Profile.php
src/Model/Term.php
src/Module/Search/Index.php
src/Network/Probe.php
src/Protocol/ActivityPub/Transmitter.php
src/Protocol/Diaspora.php
src/Protocol/OStatus.php
src/Util/Images.php
src/Util/JsonLD.php
src/Worker/SearchDirectory.php

index 9593d6ed26df2c6e5964bf8de60ac2605c590eeb..d00d0988a998a1108bc98a4393b3b3a5ff1fff6a 100644 (file)
@@ -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`
index cbee264585dbd71e95a09e4d8a1f5b9f064c1866..b21dbf31359160c856e1c22d5c3344f556daea09 100644 (file)
@@ -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);
index 51918283e0c2e48b86ac44114ae22b7af14a27cd..6c62d6cfd8b8ddccf5bd4d88b59899379ff56a88 100644 (file)
@@ -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
index 1489ed232f422fedc1da48493d9e2e1aef6e3491..63e9c55dcbf3329215a9a96bc57bb436b6602c6f 100644 (file)
@@ -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;
                }
index 410f9fea188b6111efc545b2fa58f503547d2e03..4d5d8f087c68b5a30a207eb1b4d109e32ef4914c 100644 (file)
@@ -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);
-       }
 }
index 0d05d81d0d7024e8dfee84c3320e6d087a9b846b..df4d50dd3dbc58d0380f6425ef75d7222e721a47 100644 (file)
@@ -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
index a5619c999bd1a77f7238cee6f3b8f9dfdc3ecec2..f9bb5d27a5fabc8dfd31b36ad2f646c7a52fecab 100644 (file)
@@ -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 {
index 4eca9639ff9c590bb8ee45a44963c87743b5347a..077df7386d7028b133ba88fb5773b01a553dfa5a 100644 (file)
@@ -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`
index 776b3fced992873fa5b2b9d886ab551b4cec4f68..3cf06ede73437c53617d69cfef6587cfc99887b5 100644 (file)
@@ -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)) {
index c3279cd9d24ea2fe8e863750d224c135f7e53ba5..05160771056a7c50a485440e07fdd8aa0949c2e0 100644 (file)
@@ -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;
                        }
index 9a2b584fe3f3dcd303e26e6c40f3ab1f899481c5..144ce973190c635f5570917f6b6575440fe4ff66 100644 (file)
@@ -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;
                        }
index 2d94e96c22c919a78f9ee65c7373e77a7f83f5a5..db3c80f492945ad5e57eb3e54880c1c6b3eec85f 100644 (file)
@@ -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;
                }
index 38936762e0a69037e779537c5d883c0c605b8480..04d349be0fef38ba31c1dd874dc4898e85c1d41c 100644 (file)
@@ -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'];
index b557d891d88ecdf503ae554d6704fec562b88d6f..0118689442254071c2037429d0778651ed5d6b9e 100644 (file)
@@ -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);
index 598898c0e8b3e6afad9901771bac061901def698..4a5836068d3b96be3a2fa73126503b34b7248836 100644 (file)
@@ -40,7 +40,7 @@ class JsonLD
                        exit();
                }
 
-               $result = Cache::get('documentLoader:' . $url);
+               $result = DI::cache()->get('documentLoader:' . $url);
                if (!is_null($result)) {
                        return $result;
                }
index fcac721dfdaeb5e539e376af1b07385e4cd62e00..4d3087a70fb295ba503f62590357e4d181b71233 100644 (file)
@@ -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)) {