mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 01:55:21 +02:00
refactor: use static values for cache scope
This fixes a future problem when code is placed under a namespace because `get_class($bridge)` will then return e.g. `RssBridge\Bridge\TwitterBridge` instead of the the current value `TwitterBridge`. Also a bit refactoring of `Configuration.php`.
This commit is contained in:
parent
a0a0d5235b
commit
ecb486794b
11 changed files with 42 additions and 41 deletions
|
@ -116,7 +116,7 @@ class ElloBridge extends BridgeAbstract
|
|||
$cacheFactory = new CacheFactory();
|
||||
|
||||
$cache = $cacheFactory->create();
|
||||
$cache->setScope(get_called_class());
|
||||
$cache->setScope('ElloBridge');
|
||||
$cache->setKey(['key']);
|
||||
$key = $cache->loadData();
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class InstagramBridge extends BridgeAbstract
|
|||
$cacheFactory = new CacheFactory();
|
||||
|
||||
$cache = $cacheFactory->create();
|
||||
$cache->setScope(get_called_class());
|
||||
$cache->setScope('InstagramBridge');
|
||||
$cache->setKey([$username]);
|
||||
$key = $cache->loadData();
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ HTML;
|
|||
$cacheFactory = new CacheFactory();
|
||||
|
||||
$this->clientIDCache = $cacheFactory->create();
|
||||
$this->clientIDCache->setScope(get_called_class());
|
||||
$this->clientIDCache->setScope('SoundCloudBridge');
|
||||
$this->clientIDCache->setKey(['client_id']);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class SpotifyBridge extends BridgeAbstract
|
|||
$cacheFactory = new CacheFactory();
|
||||
|
||||
$cache = $cacheFactory->create();
|
||||
$cache->setScope(get_called_class());
|
||||
$cache->setScope('SpotifyBridge');
|
||||
$cache->setKey(['token']);
|
||||
|
||||
if ($cache->getTime()) {
|
||||
|
|
|
@ -506,7 +506,8 @@ EOD;
|
|||
$cacheFactory = new CacheFactory();
|
||||
|
||||
$r_cache = $cacheFactory->create();
|
||||
$r_cache->setScope(get_called_class());
|
||||
$scope = 'TwitterBridge';
|
||||
$r_cache->setScope($scope);
|
||||
$r_cache->setKey(['refresh']);
|
||||
$data = $r_cache->loadData();
|
||||
|
||||
|
@ -521,7 +522,7 @@ EOD;
|
|||
$cacheFactory = new CacheFactory();
|
||||
|
||||
$cache = $cacheFactory->create();
|
||||
$cache->setScope(get_called_class());
|
||||
$cache->setScope($scope);
|
||||
$cache->setKey(['api_key']);
|
||||
$data = $cache->loadData();
|
||||
|
||||
|
@ -558,7 +559,7 @@ EOD;
|
|||
$cacheFac2 = new CacheFactory();
|
||||
|
||||
$gt_cache = $cacheFactory->create();
|
||||
$gt_cache->setScope(get_called_class());
|
||||
$gt_cache->setScope($scope);
|
||||
$gt_cache->setKey(['guest_token']);
|
||||
$guestTokenUses = $gt_cache->loadData();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue