1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-07 00:56:34 +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

@@ -52,7 +52,7 @@ final class RssBridge
$error = error_get_last();
if ($error) {
$message = sprintf(
'Fatal Error %s: %s in %s line %s',
'(shutdown) %s: %s in %s line %s',
$error['type'],
sanitize_root($error['message']),
sanitize_root($error['file']),

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);
}
}