1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-05 16:17:28 +02:00

fix: remove unnecessary calls to purgeCache (#3502)

This commit is contained in:
Dag
2023-07-06 18:52:19 +02:00
committed by GitHub
parent 965d7d44c5
commit 5e22459eb6
7 changed files with 22 additions and 19 deletions

View File

@@ -103,7 +103,6 @@ function getContents(
$cache = $cacheFactory->create();
$cache->setScope('server');
$cache->purgeCache(86400);
$cache->setKey([$url]);
// Snagged from https://github.com/lwthiker/curl-impersonate/blob/main/firefox/curl_ff102
@@ -424,10 +423,7 @@ function getSimpleHTMLDOMCached(
$cache = $cacheFactory->create();
$cache->setScope('pages');
$cache->purgeCache(86400);
$params = [$url];
$cache->setKey($params);
$cache->setKey([$url]);
// Determine if cached file is within duration
$time = $cache->getTime();
@@ -436,17 +432,15 @@ function getSimpleHTMLDOMCached(
&& time() - $duration < $time
&& !Debug::isEnabled()
) {
// Contents within duration and debug mode is disabled
// Cache hit
$content = $cache->loadData();
} else {
// Contents not within duration, or debug mode is enabled
$content = getContents(
$url,
$header ?? [],
$opts ?? []
);
// todo: fix bad if statement
if ($content !== false) {
if ($content) {
$cache->saveData($content);
}
}