1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-12 19:44:12 +02:00

fix: rewrite and improve caching (#3594)

This commit is contained in:
Dag
2023-09-10 21:50:15 +02:00
committed by GitHub
parent a786bbd4e0
commit 4b9f6f7e53
45 changed files with 993 additions and 1169 deletions

View File

@@ -99,23 +99,22 @@ class InstagramBridge extends BridgeAbstract
}
$cache = RssBridge::getCache();
$cache->setScope('InstagramBridge');
$cache->setKey([$username]);
$key = $cache->loadData();
$cacheKey = 'InstagramBridge_' . $username;
$pk = $cache->get($cacheKey);
if ($key == null) {
if (!$pk) {
$data = $this->getContents(self::URI . 'web/search/topsearch/?query=' . $username);
foreach (json_decode($data)->users as $user) {
if (strtolower($user->user->username) === strtolower($username)) {
$key = $user->user->pk;
$pk = $user->user->pk;
}
}
if ($key == null) {
if (!$pk) {
returnServerError('Unable to find username in search result.');
}
$cache->saveData($key);
$cache->set($cacheKey, $pk);
}
return $key;
return $pk;
}
public function collectData()