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

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