1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
cacheengineredislight.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\Data;
4
6{
7 public function __construct(array $options = [])
8 {
9 parent::__construct($options);
10 $this->useLock = false;
11 }
12
13 public function clean($baseDir, $initDir = false, $filename = false)
14 {
15 if (!self::isAvailable())
16 {
17 return;
18 }
19
20 $baseDirVersion = $this->getBaseDirVersion($baseDir);
21
22 $keyPrefix = $this->getKeyPrefix($baseDirVersion, $initDir);
23 $initListKey = $keyPrefix . '|' . self::BX_INIT_DIR_LIST;
24
25 if ($filename <> '')
26 {
27 $key = $keyPrefix . '|' . $filename;
28 $this->delFromSet($initListKey, $filename);
29 $this->del($key);
30 }
31 elseif ($initDir != '')
32 {
33 $initDirList = $keyPrefix . '|' . static::BX_INIT_DIR_LIST;
34 $keys = $this->getSet($initDirList);
35 if (!empty($keys))
36 {
37 $this->del($keys);
38 $this->delFromSet($initListKey, $keys);
39 }
40 }
41 else
42 {
43 if ($this->fullClean)
44 {
46 $this->useLock = false;
47
48 $baseDirVersion = $this->getBaseDirVersion($baseDir);
49 $baseList = $this->sid . '|' . $baseDirVersion . '|' . self::BX_BASE_LIST;
50
51 $paths = $this->getSet($baseList);
52 foreach ($paths as $path)
53 {
54 $this->addCleanPath(
55 [
56 'PREFIX' => $path,
57 'CLEAN_FROM' => (new \Bitrix\Main\Type\DateTime()),
58 'CLUSTER_GROUP' => static::$clusterGroup
59 ]);
60 }
61
62 unset($paths);
63
64 $this->set($this->sid . '|needClean', 3600, 'Y');
65 $this->del($baseList);
66 $this->useLock = $useLock;
67 }
68
69 $baseDirKey = $this->getBaseDirKey($baseDir);
70 $this->del($baseDirKey);
71 unset(static::$baseDirVersion[$baseDirKey]);
72 }
73 }
74
75 public function write($vars, $baseDir, $initDir, $filename, $ttl)
76 {
77 $baseDirVersion = $this->getBaseDirVersion($baseDir);
78
79 $keyPrefix = $this->getKeyPrefix($baseDirVersion, $initDir);
80 $key = $keyPrefix . '|' . $filename;
81
82 $exp = $this->ttlMultiplier * (int) $ttl;
83 $this->set($key, $exp, $vars);
84 $initListKey = $keyPrefix . '|' . self::BX_INIT_DIR_LIST;
85 $this->addToSet($initListKey, $key);
86
87 if ($this->fullClean)
88 {
89 $baseListKey = $this->sid . '|' . $baseDirVersion . '|' . self::BX_BASE_LIST;
90 $this->addToSet($baseListKey, $initListKey);
91 }
92
93 if (Cache::getShowCacheStat())
94 {
95 $this->written = strlen(serialize($vars));
96 $this->path = $baseDir . $initDir . $filename;
97 }
98 }
99
100 public function read(&$vars, $baseDir, $initDir, $filename, $ttl)
101 {
102 $baseDirVersion = $this->getBaseDirVersion($baseDir);
103
104 $key = $this->getKeyPrefix($baseDirVersion, $initDir) . '|' . $filename;
105 $vars = $this->get($key);
106
107 if (Cache::getShowCacheStat())
108 {
109 $this->read = strlen(serialize($vars));
110 $this->path = $baseDir . $initDir . $filename;
111 }
112
113 return $vars !== false;
114 }
115}
getKeyPrefix($baseDirVersion, $initDirVersion)
Определения keyvalueengine.php:306
static array $baseDirVersion
Определения keyvalueengine.php:22
addCleanPath(array $data)
Определения cacheengineredis.php:149
delFromSet($key, $member)
Определения cacheengineredis.php:136
addToSet($key, $value)
Определения cacheengineredis.php:110
write($vars, $baseDir, $initDir, $filename, $ttl)
Определения cacheengineredislight.php:75
__construct(array $options=[])
Определения cacheengineredislight.php:7
read(&$vars, $baseDir, $initDir, $filename, $ttl)
Определения cacheengineredislight.php:100
clean($baseDir, $initDir=false, $filename=false)
Определения cacheengineredislight.php:13
$options
Определения commerceml2.php:49
$filename
Определения file_edit.php:47
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения collection.php:2
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
$paths
Определения options.php:2080
path
Определения template_copy.php:201