Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
CacheContext Class Reference
Inheritance diagram for CacheContext:
IdentityInterface

Public Member Functions

 registerEntities ($cacheTag, $ids)
 
 registerTags ($cacheTags)
 
 getRegisteredEntity ($cacheTag)
 
 getIdentities ()
 

Protected Attributes

 $entities = []
 

Detailed Description

Class Context

Definition at line 11 of file CacheContext.php.

Member Function Documentation

◆ getIdentities()

getIdentities ( )

Returns identities

Returns
array

Implements IdentityInterface.

Definition at line 68 of file CacheContext.php.

69  {
70  $identities = [];
71  foreach ($this->entities as $cacheTag => $ids) {
72  foreach ($ids as $id) {
73  $identities[] = $cacheTag . '_' . $id;
74  }
75  }
76  return array_merge($identities, array_unique($this->tags));
77  }
$id
Definition: fieldset.phtml:14

◆ getRegisteredEntity()

getRegisteredEntity (   $cacheTag)

Returns registered entities

Parameters
string$cacheTag
Returns
array

Definition at line 54 of file CacheContext.php.

55  {
56  if (empty($this->entities[$cacheTag])) {
57  return [];
58  } else {
59  return $this->entities[$cacheTag];
60  }
61  }

◆ registerEntities()

registerEntities (   $cacheTag,
  $ids 
)

Register entity Ids

Parameters
string$cacheTag
array$ids
Returns
$this

Definition at line 30 of file CacheContext.php.

31  {
32  $this->entities[$cacheTag] = array_merge($this->getRegisteredEntity($cacheTag), $ids);
33  return $this;
34  }

◆ registerTags()

registerTags (   $cacheTags)

Register entity tags

Parameters
array$cacheTags
Returns
$this

Definition at line 42 of file CacheContext.php.

43  {
44  $this->tags = array_merge($this->tags, $cacheTags);
45  return $this;
46  }

Field Documentation

◆ $entities

$entities = []
protected

Definition at line 16 of file CacheContext.php.


The documentation for this class was generated from the following file: