• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/entity/base.php
  • Класс: BitrixMainEntityBase
  • Вызов: Base::readFromCache
public function readFromCache($ttl, $cacheId, $countTotal = false)
{
	if($ttl > 0)
	{
		$cache = MainApplication::getInstance()->getManagedCache();
		$cacheDir = $this->getCacheDir();

		$count = null;
		if($countTotal && $cache->read($ttl, $cacheId.".total", $cacheDir))
		{
			$count = $cache->get($cacheId.".total");
		}
		if($cache->read($ttl, $cacheId, $cacheDir))
		{
			$result = new MainDBArrayResult($cache->get($cacheId));
			if($count !== null)
			{
				$result->setCount($count);
			}
			return $result;
		}
	}
	return null;
}