Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
cachedpool.php
1
<?php
2
namespace
Bitrix\Location\Common
;
3
4
use
Bitrix\Main\Data\Cache
;
5
use
Bitrix\Main\EventManager
;
6
11
class
CachedPool
extends
\Bitrix\Location\Common\Cache
12
{
14
protected
$pool
;
16
protected
$cache
;
18
protected
$isItemChanged
=
false
;
19
28
public
function
__construct
(
Pool
$pool
,
int
$ttl,
string
$cacheId,
Cache
$cache
,
EventManager
$eventManager)
29
{
30
$this->pool =
$pool
;
31
parent::__construct($ttl, $cacheId,
$cache
, $eventManager);
32
}
33
34
public
function
loadDataFromCache
(): void
35
{
36
$items = $this->cache->getVars()[
'items'
];
37
if
(is_array($items))
38
{
39
$this->pool->setItems($items);
40
}
41
}
42
43
public
function
saveDataToCache
(): void
44
{
45
if
($this->isItemChanged)
46
{
47
$this->cache->forceRewriting(
true
);
48
$this->cache->startDataCache();
49
$this->cache->endDataCache([
'items'
=> $this->pool->getItems()]);
50
}
51
}
52
57
public
function
getItem
(
string
$key)
58
{
59
return
$this->pool->getItem($key);
60
}
61
66
public
function
addItem
(
string
$key, $value): void
67
{
68
$this->pool->addItem($key, $value);
69
$this->isItemChanged =
true
;
70
}
71
75
public
function
deleteItem
(
string
$key): void
76
{
77
$this->pool->deleteItem($key);
78
$this->isItemChanged =
true
;
79
}
80
81
public
function
cleanItems
(): void
82
{
83
$this->pool->cleanItems();
84
$this->isItemChanged =
true
;
85
}
86
}
Bitrix\Location\Common\Cache
Definition
cache.php:13
Bitrix\Location\Common\CachedPool
Definition
cachedpool.php:12
Bitrix\Location\Common\CachedPool\$pool
$pool
Definition
cachedpool.php:14
Bitrix\Location\Common\CachedPool\saveDataToCache
saveDataToCache()
Definition
cachedpool.php:43
Bitrix\Location\Common\CachedPool\cleanItems
cleanItems()
Definition
cachedpool.php:81
Bitrix\Location\Common\CachedPool\getItem
getItem(string $key)
Definition
cachedpool.php:57
Bitrix\Location\Common\CachedPool\loadDataFromCache
loadDataFromCache()
Definition
cachedpool.php:34
Bitrix\Location\Common\CachedPool\deleteItem
deleteItem(string $key)
Definition
cachedpool.php:75
Bitrix\Location\Common\CachedPool\__construct
__construct(Pool $pool, int $ttl, string $cacheId, Cache $cache, EventManager $eventManager)
Definition
cachedpool.php:28
Bitrix\Location\Common\CachedPool\$cache
$cache
Definition
cachedpool.php:16
Bitrix\Location\Common\CachedPool\addItem
addItem(string $key, $value)
Definition
cachedpool.php:66
Bitrix\Location\Common\CachedPool\$isItemChanged
$isItemChanged
Definition
cachedpool.php:18
Bitrix\Location\Common\Pool
Definition
pool.php:9
Bitrix\Main\Data\Cache
Definition
cache.php:16
Bitrix\Main\EventManager
Definition
eventmanager.php:15
Bitrix\Location\Common
Definition
baseservice.php:3
modules
location
lib
common
cachedpool.php
Создано системой
1.10.0