CleanUp Cache namespace

- Introduce enum "Duration"
- Introduce enum "Type"
- Move "Cache\Cache" to "BaseCache"
This commit is contained in:
nupplaPhil 2020-01-18 15:41:19 +01:00
parent 4e83b2930e
commit 424c87195b
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
37 changed files with 139 additions and 118 deletions

View file

@ -7,7 +7,7 @@ namespace Friendica\Protocol\ActivityPub;
use Friendica\Content\Feature;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\Plaintext;
use Friendica\Core\Cache\Cache;
use Friendica\Core\Cache\Duration;
use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
@ -827,7 +827,7 @@ class Transmitter
$data = ActivityPub\Transmitter::createActivityFromItem($item_id);
DI::cache()->set($cachekey, $data, Cache::QUARTER_HOUR);
DI::cache()->set($cachekey, $data, Duration::QUARTER_HOUR);
return $data;
}

View file

@ -13,7 +13,7 @@ namespace Friendica\Protocol;
use Friendica\Content\Feature;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\Markdown;
use Friendica\Core\Cache\Cache;
use Friendica\Core\Cache\Duration;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
@ -3272,7 +3272,7 @@ class Diaspora
Logger::log("Send participation for ".$item["guid"]." by ".$author, Logger::DEBUG);
// It doesn't matter what we store, we only want to avoid sending repeated notifications for the same item
DI::cache()->set($cachekey, $item["guid"], Cache::QUARTER_HOUR);
DI::cache()->set($cachekey, $item["guid"], Duration::QUARTER_HOUR);
return self::buildAndTransmit($owner, $contact, "participation", $message);
}
@ -3628,7 +3628,7 @@ class Diaspora
$msg = ["type" => $type, "message" => $message];
DI::cache()->set($cachekey, $msg, Cache::QUARTER_HOUR);
DI::cache()->set($cachekey, $msg, Duration::QUARTER_HOUR);
return $msg;
}
@ -3798,7 +3798,7 @@ class Diaspora
$comment['thread_parent_guid'] = $thread_parent_item['guid'];
}
DI::cache()->set($cachekey, $comment, Cache::QUARTER_HOUR);
DI::cache()->set($cachekey, $comment, Duration::QUARTER_HOUR);
return($comment);
}

View file

@ -8,10 +8,9 @@ use DOMDocument;
use DOMXPath;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Cache\Cache;
use Friendica\Core\Cache\Duration;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Lock;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
@ -2246,7 +2245,7 @@ class OStatus
$feeddata = trim($doc->saveXML());
$msg = ['feed' => $feeddata, 'last_update' => $last_update];
DI::cache()->set($cachekey, $msg, Cache::QUARTER_HOUR);
DI::cache()->set($cachekey, $msg, Duration::QUARTER_HOUR);
Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created, Logger::DEBUG);