43 $cache = Cache::createInstance();
44 $cacheId = static::getCacheId(
'toolbar',
$context, $toolbarUserId);
45 $cachePath = static::getCachePath($toolbarUserId);
46 if ($cache->initCache(static::CACHE_TTL, $cacheId, $cachePath))
48 $vars = $cache->getVars();
49 $entity = is_array($vars[
'toolbar']) ? EO_Toolbar::wakeUp($vars[
'toolbar']) :
null;
51 return $entity ?
new static($entity) :
null;
57 '=USER_ID' => $toolbarUserId,
61 $cache->startDataCache();
62 $cache->endDataCache([
'toolbar' => $entity ? $entity->collectValues() :
null]);
64 return $entity ?
new static($entity) :
null;
70 if ($toolbarEntity ===
null)
73 $toolbarEntity->setContext(
$context);
75 $result = $toolbarEntity->save();
79 throw new \Bitrix\Main\SystemException(
$result->getErrors()[0]->getMessage(),
$result->getErrors()[0]->getCode());
82 $toolbar =
new static($toolbarEntity);
83 $toolbar->clearToolbarCache();
88 return $toolbarEntity;
151 $cache = Cache::createInstance();
153 $cachePath = static::getCachePath($this->
getUserId());
154 if ($cache->initCache(static::CACHE_TTL, $cacheId, $cachePath))
156 $vars = $cache->getVars();
158 return EO_ToolbarItem_Collection::wakeUp($vars[
'items']);
163 '=TOOLBAR_ID' => $this->
getId(),
165 'order' => [
'LAST_USE_DATE' =>
'DESC'],
167 ])->fetchCollection();
170 foreach ($itemCollection as $item)
172 $items[] = $item->collectValues();
175 $cache->startDataCache();
176 $cache->endDataCache([
'items' =>
$items]);
178 return $itemCollection;