Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
cache.php
1<?php
2
3namespace Bitrix\B24Connector;
4
6
12final class Cache
13{
14 const CACHE_ROOT = '/b24connector';
15
23 public static function remember(string $cacheId, int $ttl, callable $callback)
24 {
25 $cachePath = self::CACHE_ROOT . '/' . $cacheId;
26 $manager = Application::getInstance()->getCache();
27 if ($manager->initCache($ttl, $cacheId, $cachePath))
28 {
29 $cached = $manager->getVars();
30 return $cached['PROXY'];
31 }
32 else
33 {
34 $result = $callback();
35 $manager->startDataCache();
36 $manager->endDataCache(['PROXY' => $result]);
37 return $result;
38 }
39 }
40}
static remember(string $cacheId, int $ttl, callable $callback)
Definition cache.php:23