1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-20 23:31:37 +02:00

refactor: loadCacheValue/saveCacheValue (#4205)

This commit is contained in:
Dag
2024-08-08 17:47:04 +02:00
committed by GitHub
parent 2acd415475
commit f358f1abec
8 changed files with 188 additions and 158 deletions

View File

@@ -164,7 +164,7 @@ class BugzillaBridge extends BridgeAbstract
}
$cache = $this->loadCacheValue($this->instance . $user);
if (!is_null($cache)) {
if ($cache) {
return $cache;
}

View File

@@ -676,7 +676,7 @@ class FurAffinityBridge extends BridgeAbstract
$name = parent::getName();
if ($this->getOption('aCookie') !== null) {
$username = $this->loadCacheValue('username');
if ($username !== null) {
if ($username) {
$name = $username . '\'s ' . parent::getName();
}
}

View File

@@ -667,7 +667,7 @@ class ItakuBridge extends BridgeAbstract
if ($getJSON) { //get JSON object
if ($cache) {
$data = $this->loadCacheValue($url);
if (is_null($data)) {
if (!$data) {
$data = getContents($url, $httpHeaders, $curlOptions);
$this->saveCacheValue($url, $data);
}

View File

@@ -105,7 +105,7 @@ class MastodonBridge extends BridgeAbstract
break;
}
$rtUser = $this->loadCacheValue($rtContent['attributedTo']);
if (!isset($rtUser)) {
if (!$rtUser) {
// We fetch the author, since we cannot always assume the format of the URL.
$user = $this->fetchAP($rtContent['attributedTo']);
preg_match('/https?:\/\/([a-z0-9-\.]{0,})\//', $rtContent['attributedTo'], $matches);

View File

@@ -314,7 +314,7 @@ class PixivBridge extends BridgeAbstract
{
// checks if cookie is set, if not initialise it with the cookie from the config
$value = $this->loadCacheValue('cookie');
if (!isset($value)) {
if (!$value) {
$value = $this->getOption('cookie');
// 30 days + 1 day to let cookie chance to renew

View File

@@ -118,7 +118,7 @@ The default URI shows the Madara demo page.';
{
$url_cache = 'TitleInfo_' . preg_replace('/[^\w]/', '.', rtrim($url, '/'));
$cache = $this->loadCacheValue($url_cache);
if (isset($cache)) {
if ($cache) {
return $cache;
}