Load the state of the caching memory array from a given cache file cache

@param string $id cache id
@param string $group name of the cache group
@param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
@access public
188619
function getMemoryCachingState($id, $group = 'default', $doNotTestCacheValidity = false)
    {
        if ($this->_caching) {
            if ($data = $this->get($id, $group, $doNotTestCacheValidity)) {
                $array = unserialize($data);
                $this->_memoryCachingCounter = $array['counter'];
                $this->_memoryCachingArray = $array['array'];
            }
        }
    }
490205
public function contains( $id ) {

		foreach ( $this->caches as $cache ) {
			if ( $cache->contains( $id ) ) {
				return true;
			}
		}

		return false;
	}
1087995
function saveMemoryCachingState($id, $group = 'default')
    {
        if ($this->_caching) {
            $array = array(
                'counter' => $this->_memoryCachingCounter,
                'array' => $this->_memoryCachingArray
            );
            $data = serialize($array);
            $this->save($data, $id, $group);
        }
    }
126329
public function share_with_group(string $id, string $id_group, bool $cancel = false): ?int
  {
    if ( $cfg = $this->get($id) ){

      $id_share = $this->db->select_one($this->class_table, $this->fields['id'], [
        'id_alias' => $id,
        'id_group' => $id_group
      ]);
      if ( $cancel && $id_share ){
        return $this->db->delete($this->class_table, [$this->fields['id'] => $id_share]);
      }
      else if ( !$cancel && !$id_share ){
        return $this->db->insert($this->class_table, [
          'id_option' => $cfg['id_option'],
          'id_alias' => $id,
          'id_group' => $id_group
        ]);
      }
      return 0;
    }
    return null;
  }
822807
private function load($id)
    {

        $this->initialize();
        $this->id = $id;
        $ok = $this->dataConnector->loadToolProxy($this);
        if (!$ok) {
            $this->enabled = $autoEnable;
        }

        return $ok;

    }
755105
public function loadObjectStateGroupData($groupId)
    {
        $query = $this->createObjectStateGroupFindQuery();
        $query->where(
            $query->expr->eq(
                $this->dbHandler->quoteColumn('id', 'ezcobj_state_group'),
                $query->bindValue($groupId, null, \PDO::PARAM_INT)
            )
        );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(\PDO::FETCH_ASSOC);
    }
903926
protected function loadFromCache($id, $alphabet)
    {
        if (isset($this->mappingCache[$id]) && isset($this->mappingCache[$id][$alphabet])) {
            return $this->mappingCache[$id][$alphabet];
        }

        return null;
    }
1320386
public function run($propertyGroupId, $id = null)
    {
        /** @var PropertyGroup $propertyGroup */
        $propertyGroup = PropertyGroup::loadModel(
            $propertyGroupId,
            false,
            true,
            86400,
            new NotFoundHttpException("PropertyGroup model with specified id not found")
        );

        /** @var Property $model */
        $model = Property::loadModel(
            $id,
            true,
            true,
            86400,
            new NotFoundHttpException("PropertyGroup model with specified id not found")
        );
        $wizardData = Module::getInstance()->prepareWizardData();
        $wizardData['isNewRecord'] = $model->isNewRecord;
        $wizardData = Json::encode($wizardData);
        $this->controller->getView()->registerJs("window.WizardData = {$wizardData};", View::POS_HEAD);
        if ($model->isNewRecord === false) {
            // populate translations relation as we need to save all
            $model->translations;
        }
        $post = Yii::$app->request->post();
        $canSave = Yii::$app->user->can('dst-property-edit');
        if (false === empty($post) && false === $canSave) {
            throw new ForbiddenHttpException(
                Yii::t('yii', 'You are not allowed to perform this action.')
            );
        }
        if (Yii::$app->request->isPost && $model->load($post)) {
            foreach (Yii::$app->request->post('PropertyTranslation', []) as $language => $data) {
                foreach ($data as $attribute => $translation) {
                    $model->translate($language)->$attribute = $translation;
                }
            }

            $event = new ModelEditAction($model);
            $this->controller->trigger(
                $model->isNewRecord ? self::EVENT_BEFORE_INSERT : self::EVENT_BEFORE_UPDATE,
                $event
            );

            $params = $model->params;
            $handlerParams = Yii::$app->request->post(Property::PACKED_ADDITIONAL_RULES, []);
            $params[Property::PACKED_ADDITIONAL_RULES] = $handlerParams;
            $model->params = $params;

            if ($event->isValid === true && $model->save() && !Yii::$app->request->isPjax) {
                \yii\caching\TagDependency::invalidate(
                    $propertyGroup->getTagDependencyCacheComponent(),
                    [
                        $propertyGroup::commonTag(),
                        $propertyGroup->objectTag()
                    ]
                );
                if ($id === null) {
                    // That was new record - link it to property group
                    $propertyGroup->link(
                        'properties',
                        $model,
                        [
                            'sort_order_group_properties' => count($propertyGroup->properties),
                        ]
                    );
                }

                $event = new ModelEditAction($model);
                $this->controller->trigger($id === null ? self::EVENT_AFTER_INSERT : self::EVENT_AFTER_UPDATE, $event);

                if ($event->isValid === true) {
                    Yii::$app->session->setFlash('success', Module::t('app', 'Property saved.'));

                    return $this->controller->redirect([
                        $this->listGroupPropertiesActionId,
                        'id' => $propertyGroup->id,
                    ]);
                }
            } else {
                Yii::$app->session->setFlash('error', Module::t('app', 'Error occurred while saving property.'));
            }
        }

        return $this->render([
            'model' => $model,
            'listGroupPropertiesActionId' => $this->listGroupPropertiesActionId,
            'listPropertyGroupsActionId' => $this->listPropertyGroupsActionId,
            'propertyGroup' => $propertyGroup,
            'canSave' => $canSave,
        ]);
    }
837084
public static Group get(final long _id)
        throws CacheReloadException
    {
        final Cache<Long, Group> cache = InfinispanCache.get().<Long, Group>getCache(Group.IDCACHE);
        if (!cache.containsKey(_id) && !Group.getGroupFromDB(Group.SQL_ID, _id)) {
            cache.put(_id, Group.NULL, 100, TimeUnit.SECONDS);
        }
        final Group ret = cache.get(_id);
        return ret.equals(Group.NULL) ? null : ret;
    }
640647
public function loadRoleAssignmentsByGroupId($groupId, $inherited = false)
    {
        try {
            return $this->innerGateway->loadRoleAssignmentsByGroupId($groupId, $inherited);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
393669
private void putInCache(Group group)
   {
      cache.put(group.getId(), group, CacheType.GROUP);
   }
1074011
public function loadObjectStateDataByIdentifier($identifier, $groupId)
    {
        $query = $this->createObjectStateFindQuery();
        $query->where(
            $query->expr->lAnd(
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('identifier', 'ezcobj_state'),
                    $query->bindValue($identifier, null, \PDO::PARAM_STR)
                ),
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('group_id', 'ezcobj_state'),
                    $query->bindValue($groupId, null, \PDO::PARAM_INT)
                )
            )
        );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(\PDO::FETCH_ASSOC);
    }
396759
public function isCached($id) {
        if ($id != null) {
            $id = $this->getIDfromOjb($id);
        }

        if ($id == null)
            return false;

        $cachefile = $this->getConfig('cacheDir') . '/' . utf8_decode($id);
        $cachetime = $this->getConfig('cacheTime');

        if (file_exists($cachefile) && time() - $cachetime < fileatime($cachefile)) {
            return true;
        }

        return false;
    }
229741
public static function getCachedInfo($id, $key = null, $default = null)
    {
        $cacheKey = 'role:' . $id;
        try {
            $result = \Cache::remember($cacheKey, \Config::get('df.default_cache_ttl'), function () use ($id){
                $role = Role::with(
                    [
                        'role_service_access_by_role_id',
                        'service_by_role_service_access'
                    ]
                )->whereId($id)->first();

                if (empty($role)) {
                    throw new NotFoundException("Role not found.");
                }

                $roleInfo = $role->toArray();
                $services = array_get($roleInfo, 'service_by_role_service_access');
                unset($roleInfo['service_by_role_service_access']);

                foreach ($roleInfo['role_service_access_by_role_id'] as $key => $value) {
                    $serviceName = array_by_key_value(
                        $services,
                        'id',
                        array_get($value, 'service_id'), 'name'
                    );
                    $component = array_get($value, 'component');
                    $roleInfo['role_service_access_by_role_id'][$key]['service'] = $serviceName;
                    $roleInfo['role_service_access_by_role_id'][$key]['component'] = trim($component, '/');
                }

                return $roleInfo;
            });

            if (is_null($result)) {
                return $default;
            }
        } catch (ModelNotFoundException $ex) {
            return $default;
        }

        if (is_null($key)) {
            return $result;
        }

        return (isset($result[$key]) ? $result[$key] : $default);
    }
430163
function start($id, $group = 'default', $doNotTestCacheValidity = false)
    {
        $data = $this->get($id, $group, $doNotTestCacheValidity);
        if ($data !== false) {
            echo($data);
            return true;
        }
        ob_start();
        ob_implicit_flush(false);
        return false;
    }
63175
public function getProperties($id, & $state_cache = null)
	{
		if ($id === null || $id === array()) {
			throw new InstanceDoesNotExistException('State machine instance does not exist (null ID).');
		}

		$q = $this->createQueryBuilder()
			->select(null)
			->limit(1);

		$this->queryAddPropertiesSelect($q);
		$this->queryAddPrimaryKeyWhere($q, $id);

		if ($this->load_state_with_properties) {
			$this->queryAddStateSelect($q);
		}

		$r = $q->query();
		$props = $r->fetch(\PDO::FETCH_ASSOC);
		$r->closeCursor();

		if ($props === false) {
			throw new InstanceDoesNotExistException('State machine instance not found: '
				.json_encode($id, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE| JSON_NUMERIC_CHECK));
		}

		if ($this->load_state_with_properties) {
			$state_cache = array_pop($props);
		}

		return $this->decodeProperties($props);
	}
285503
public void setCacheGroupContainer(String key, CmsXmlGroupContainer groupContainer, boolean online) {

        try {
            m_lock.writeLock().lock();
            if (online) {
                m_groupContainersOnline.put(key, groupContainer);
                if (LOG.isDebugEnabled()) {
                    LOG.debug(
                        Messages.get().getBundle().key(
                            Messages.LOG_DEBUG_CACHE_SET_ONLINE_2,
                            new Object[] {key, groupContainer}));
                }
            } else {
                m_groupContainersOffline.put(key, groupContainer);
                if (LOG.isDebugEnabled()) {
                    LOG.debug(
                        Messages.get().getBundle().key(
                            Messages.LOG_DEBUG_CACHE_SET_OFFLINE_2,
                            new Object[] {key, groupContainer}));
                }
            }
        } finally {
            m_lock.writeLock().unlock();
        }
    }