mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-17 22:02:09 +02:00
fix: rewrite and improve caching (#3594)
This commit is contained in:
@@ -114,18 +114,17 @@ class ElloBridge extends BridgeAbstract
|
||||
private function getAPIKey()
|
||||
{
|
||||
$cache = RssBridge::getCache();
|
||||
$cache->setScope('ElloBridge');
|
||||
$cache->setKey(['key']);
|
||||
$key = $cache->loadData();
|
||||
$cacheKey = 'ElloBridge_key';
|
||||
$apiKey = $cache->get($cacheKey);
|
||||
|
||||
if ($key == null) {
|
||||
$keyInfo = getContents(self::URI . 'api/webapp-token') or
|
||||
returnServerError('Unable to get token.');
|
||||
$key = json_decode($keyInfo)->token->access_token;
|
||||
$cache->saveData($key);
|
||||
if (!$apiKey) {
|
||||
$keyInfo = getContents(self::URI . 'api/webapp-token') or returnServerError('Unable to get token.');
|
||||
$apiKey = json_decode($keyInfo)->token->access_token;
|
||||
$ttl = 60 * 60 * 20;
|
||||
$cache->set($cacheKey, $apiKey, $ttl);
|
||||
}
|
||||
|
||||
return $key;
|
||||
return $apiKey;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
|
Reference in New Issue
Block a user