• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/composite/data/memcachedstorage.php
  • Класс: BitrixMainCompositeDataMemcachedStorage
  • Вызов: MemcachedStorage::write
public function write($content, $md5)
{
	$flags = 0;
	if ($this->compression)
	{
		$flags = MemcachedResponse::MEMCACHED_GZIP_FLAG;
		$content = gzencode($content, 4);
	}

	if (!$this->memcached || !$this->memcached->set($this->cacheKey, $content, $flags))
	{
		return false;
	}

	$this->props = new stdClass();
	$this->props->mtime = time();
	$this->props->etag = md5($this->cacheKey.$this->props->size.$this->props->mtime);
	$this->props->type = "text/html; charset=".LANG_CHARSET;
	$this->props->md5 = $md5;
	$this->props->gzip = $this->compression;

	$this->props->size = strlen($content);
	$this->props->size += strlen(serialize($this->props));

	$this->memcached->set("~".$this->cacheKey, $this->props);

	return $this->props->size;
}