1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Cache.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Space\Cache
;
4
5
use \Bitrix\Main\Data;
6
7
class
Cache
8
{
9
public
const
CACHE_ID
=
'socialnetwork-toolbar-composition-'
;
10
private
const
TTL = 86400;
11
private
const
DIRECTORY =
'socialnetwork'
;
12
13
private
Data\Cache
$cache;
14
15
public
function
__construct
(
private
int
$userId
,
private
int
$spaceId)
16
{
17
$this->init();
18
}
19
20
public
function
store
(
array
$data
): void
21
{
22
$this->cache->forceRewriting(
true
);
23
$this->cache->startDataCache();
24
$this->cache->endDataCache(
$data
);
25
}
26
27
public
function
get
():
array
28
{
29
if
(!$this->
initCache
())
30
{
31
return
[];
32
}
33
$variables = $this->cache->getVars();
34
return
is_array($variables) ? $variables : [];
35
}
36
37
public
function
initCache
(): bool
38
{
39
return
$this->cache->initCache(static::TTL, $this->getCacheId(), static::DIRECTORY);
40
}
41
42
private
function
init(): void
43
{
44
$this->cache = Data\Cache::createInstance();
45
$this->initCache();
46
}
47
48
private
function
getCacheId(): string
49
{
50
return
static::CACHE_ID . $this->userId .
'-'
. $this->spaceId;
51
}
52
}
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Socialnetwork\Space\Cache\Cache\initCache
initCache()
Определения
Cache.php:37
Bitrix\Socialnetwork\Space\Cache\Cache\__construct
__construct(private int $userId, private int $spaceId)
Определения
Cache.php:15
Bitrix\Socialnetwork\Space\Cache\Cache\CACHE_ID
const CACHE_ID
Определения
Cache.php:9
Bitrix\Socialnetwork\Space\Cache\Cache\store
store(array $data)
Определения
Cache.php:20
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Main\Data\Cache
Определения
keyvalueengine.php:3
Bitrix\Socialnetwork\Space\Cache
Определения
Cache.php:3
bitrix
modules
socialnetwork
lib
Space
Cache
Cache.php
Создано системой
1.14.0