mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-01 06:10:22 +02:00
refacor: improve cache interface (#3492)
* fix: proper typehint on setScope * refactor: type hint setKey() * typehint
This commit is contained in:
@@ -91,7 +91,7 @@ class DisplayAction implements ActionInterface
|
||||
|
||||
$cache = $cacheFactory->create();
|
||||
$cache->setScope('');
|
||||
$cache->purgeCache(86400); // 24 hours
|
||||
$cache->purgeCache(86400);
|
||||
$cache->setKey($cache_params);
|
||||
|
||||
$items = [];
|
||||
@@ -215,7 +215,7 @@ class DisplayAction implements ActionInterface
|
||||
$cache = $cacheFactory->create();
|
||||
$cache->setScope('error_reporting');
|
||||
$cache->setkey([$bridgeName . '_' . $code]);
|
||||
$cache->purgeCache(86400); // 24 hours
|
||||
$cache->purgeCache(86400);
|
||||
if ($report = $cache->loadData()) {
|
||||
$report = Json::decode($report);
|
||||
$report['time'] = time();
|
||||
|
@@ -39,6 +39,10 @@ class SetBridgeCacheAction implements ActionInterface
|
||||
|
||||
$cache = $cacheFactory->create();
|
||||
$cache->setScope(get_class($bridge));
|
||||
if (!is_array($key)) {
|
||||
// not sure if $key is an array when it comes in from request
|
||||
$key = [$key];
|
||||
}
|
||||
$cache->setKey($key);
|
||||
$cache->saveData($value);
|
||||
|
||||
|
Reference in New Issue
Block a user