1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
storagecache.php
См. документацию.
1<?php
2namespace Bitrix\Rest\OAuth;
3
4
5use Bitrix\Main\Application;
6use Bitrix\Rest\AuthStorageInterface;
7
9{
10 const CACHE_TTL = 3600;
11 const CACHE_PREFIX = "oauth_";
12
13 public function store(array $authResult)
14 {
15 $cache = $this->getCache();
16
17 $cache->read(static::CACHE_TTL, $this->getCacheId($authResult["access_token"]));
18 $cache->set($this->getCacheId($authResult["access_token"]), $authResult);
19 }
20
21 public function rewrite(array $authResult)
22 {
23 $cache = $this->getCache();
24
25 $cache->clean($this->getCacheId($authResult["access_token"]));
26 $cache->read(static::CACHE_TTL, $this->getCacheId($authResult["access_token"]));
27 $cache->set($this->getCacheId($authResult["access_token"]), $authResult);
28 }
29
30 public function restore($accessToken)
31 {
32 $cache = $this->getCache();
33
34 $authResult = false;
35
36 if($readResult = $cache->read(static::CACHE_TTL, $this->getCacheId($accessToken)))
37 {
38 $authResult = $cache->get($this->getCacheId($accessToken));
39 }
40
41 return $authResult;
42 }
43
44 protected function getCacheId($accessToken)
45 {
46 return static::CACHE_PREFIX.$accessToken;
47 }
48
49 protected function getCache()
50 {
51 return Application::getInstance()->getManagedCache();
52 }
53}
getCacheId($accessToken)
Определения storagecache.php:44
store(array $authResult)
Определения storagecache.php:13
restore($accessToken)
Определения storagecache.php:30
rewrite(array $authResult)
Определения storagecache.php:21
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804