- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/data/cacheengine.php
- Класс: BitrixMainDataCacheEngine
- Вызов: CacheEngine::write
public function write($vars, $baseDir, $initDir, $filename, $ttl)
{
$baseDirVersion = $this->getBaseDirVersion($baseDir);
$initDirVersion = $this->getInitDirVersion($baseDir, $initDir);
$dir = sha1($baseDirVersion . '|' . $initDirVersion);
$key = $this->sid. '|' . $dir . '|' . $filename;
$exp = $this->ttlMultiplier * (int) $ttl;
if ($this->useLock)
{
$this->set($key, $exp, ['datecreate' => time(), 'content' => $vars]);
$this->del($key . '|old');
$this->unlock($key, $ttl);
}
else
{
$this->set($key, $exp, $vars);
}
$initListKey = $this->sid . '|' . $dir . self::BX_DIR_LIST;
$initPartition = $this->getPartition($filename);
$initListKeyPartition = $initListKey . $initPartition;
$this->addToSet($initListKeyPartition, $filename);
$this->addToSet($initListKey, $initPartition);
if ($this->fullClean)
{
$baseListKey = $this->sid . '|' . $baseDirVersion . self::BX_BASE_LIST;
$baseListKeyPartition = $this->getPartition($initListKeyPartition);
$this->addToSet($baseListKey . $baseListKeyPartition, $initListKeyPartition);
$this->addToSet($baseListKey, $baseListKeyPartition);
}
}