• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/data/statichtmlmemcachedstorage.php
  • Класс: BitrixMainDataStaticHtmlMemcachedStorage
  • Вызов: StaticHtmlMemcachedStorage::write
public function write($content, $md5)
{
	$flags = 0;
	if ($this->compression)
	{
		$flags = StaticHtmlMemcachedResponse::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;

	if (function_exists("mb_strlen"))
	{
		$this->props->size = mb_strlen($content, "latin1");
		$this->props->size += mb_strlen(serialize($this->props), "latin1");
	}
	else
	{
		$this->props->size = strlen($content);
		$this->props->size += strlen(serialize($this->props));
	}

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

	return $this->props->size;
}