mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-29 06:38:51 +03:00
fix(cache): bug in prior refactor (#3525)
* fix(cache): bug in prior refactor * yup
This commit is contained in:
parent
b3bf95bfdd
commit
69aa751f40
1 changed files with 7 additions and 1 deletions
|
@ -12,7 +12,7 @@ class TwitterClient
|
|||
{
|
||||
$this->cache = $cache;
|
||||
$this->authorization = 'AAAAAAAAAAAAAAAAAAAAAGHtAgAAAAAA%2Bx7ILXNILCqkSGIzy6faIHZ9s3Q%3DQy97w6SIrzE7lQwPJEYQBsArEE2fC25caFwRBvAGi456G09vGR';
|
||||
$this->data = $cache->loadData() ?? [];
|
||||
$this->data = $this->cache->loadData() ?? [];
|
||||
}
|
||||
|
||||
public function fetchUserTweets(string $screenName): \stdClass
|
||||
|
@ -95,6 +95,9 @@ class TwitterClient
|
|||
$response = getContents($url, $this->createHttpHeaders(), [CURLOPT_POST => true]);
|
||||
$guest_token = json_decode($response)->guest_token;
|
||||
$this->data['guest_token'] = $guest_token;
|
||||
|
||||
$this->cache->setScope('twitter');
|
||||
$this->cache->setKey(['cache']);
|
||||
$this->cache->saveData($this->data);
|
||||
Logger::info("Fetch new guest token: $guest_token");
|
||||
}
|
||||
|
@ -119,6 +122,9 @@ class TwitterClient
|
|||
}
|
||||
$userInfo = $response->data->user;
|
||||
$this->data[$screenName] = $userInfo;
|
||||
|
||||
$this->cache->setScope('twitter');
|
||||
$this->cache->setKey(['cache']);
|
||||
$this->cache->saveData($this->data);
|
||||
return $userInfo;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue