Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
cache.php
1<?php
3
6
12abstract class Cache
13{
15 protected $cache;
16
24 public function __construct(int $ttl, string $cacheId, Data\Cache $cache, EventManager $eventManager)
25 {
26 $cacheDir = '/location';
27 $this->cache = $cache;
28
29 if($this->cache->initCache($ttl, $cacheId, $cacheDir))
30 {
31 $this->loadDataFromCache();
32 }
33
34 $eventManager->addEventHandler('main', 'OnAfterEpilog', [$this, 'saveDataToCache']);
35 }
36
37 abstract protected function loadDataFromCache(): void;
38 abstract public function saveDataToCache(): void;
39}
__construct(int $ttl, string $cacheId, Data\Cache $cache, EventManager $eventManager)
Definition cache.php:24
addEventHandler($fromModuleId, $eventType, $callback, $includeFile=false, $sort=100)