Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
cache.php
1<?php
3
4use \Bitrix\Landing\Manager;
5
6class Cache
7{
11 const TAG_PREFIX = 'landing_block_';
12
13 protected static $cacheDisabled = false;
14
19 public static function disableCache(): void
20 {
21 self::$cacheDisabled = true;
22 }
23
28 public static function enableCache(): void
29 {
30 self::$cacheDisabled = false;
31 }
32
37 public static function isCaching(): bool
38 {
39 if (self::$cacheDisabled)
40 {
41 return false;
42 }
43 return defined('BX_COMP_MANAGED_CACHE') &&
44 BX_COMP_MANAGED_CACHE === true;
45 }
46
52 public static function register($id): void
53 {
54 $id = intval($id);
55
56 if ($id > 0 && self::isCaching())
57 {
58 Manager::getCacheManager()->registerTag(
59 self::TAG_PREFIX . $id
60 );
61 }
62 }
63
69 public static function clear($id): void
70 {
71 $id = intval($id);
72
73 if ($id > 0 && self::isCaching())
74 {
75 Manager::getCacheManager()->clearByTag(
76 self::TAG_PREFIX . $id
77 );
78 }
79 }
80}
static getCacheManager()
Definition manager.php:89