Хранилище access_token вынесено в redis

Переписана логика связи моделей для oAuth процесса
This commit is contained in:
ErickSkrauch
2016-11-30 02:19:14 +03:00
parent 4f259a9dc7
commit 422d5c4fd4
12 changed files with 297 additions and 146 deletions

View File

@@ -24,7 +24,7 @@ class Key {
}
public function setValue($value) {
$this->getRedis()->set($this->key, json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
$this->getRedis()->set($this->key, $value);
return $this;
}
@@ -37,11 +37,16 @@ class Key {
return (bool)$this->getRedis()->exists($this->key);
}
public function expire($ttl) {
public function expire(int $ttl) {
$this->getRedis()->expire($this->key, $ttl);
return $this;
}
public function expireAt(int $unixTimestamp) {
$this->getRedis()->expireat($this->key, $unixTimestamp);
return $this;
}
public function __construct(...$key) {
if (empty($key)) {
throw new InvalidArgumentException('You must specify at least one key.');