FirstLevelNodeCache
class FirstLevelNodeCache (View source)
A first level cache for the NodeDataRepository. It is used to keep Nodes in memory (indexed by identifier and path) and allows to fetch them by path or identifier as single node.
The caching of multiple nodes below a certain path is possible as well, using the *ChildNodesByPathAndNodeTypeFilter() methods.
Properties
protected NodeInterface[] | $nodesByPath | ||
protected NodeInterface[] | $nodesByIdentifier | ||
protected NodeInterface[] | $childNodesByPathAndNodeTypeFilter |
Methods
If the cache contains a node for the given path, it is returned.
Adds the given node to the cache for the given path. The node will also be added under it's identifier.
If the cache contains a node with the given identifier, it is returned.
Adds the given node to the cache for the given identifier. The node will also be added with is's path.
Removes the Node with identifier $identifier from the cache.
Removes the Node Path $nodePath from the cache.
Returns the cached child nodes for the given path and node type filter.
Sets the given nodes as child nodes for the given path and node type filter.
Flush the cache.
Details
NodeInterface|bool
getByPath(string $path)
If the cache contains a node for the given path, it is returned.
Otherwise false is returned.
void
setByPath(string $path, NodeInterface $node = null)
Adds the given node to the cache for the given path. The node will also be added under it's identifier.
NodeInterface|bool
getByIdentifier(string $identifier)
If the cache contains a node with the given identifier, it is returned.
Otherwise false is returned.
void
setByIdentifier(string $identifier, NodeInterface $node = null)
Adds the given node to the cache for the given identifier. The node will also be added with is's path.
removeNodeFromIdentifierCache(string $identifier)
Removes the Node with identifier $identifier from the cache.
This is needed in extremely rare cases: When loading Nodes in the Security Framework, we need to ensure we do not pollute the Node cache, as otherwise these nodes will be found lateron when the actual queries are made.
removeNodeFromPathCache(string $nodePath)
Removes the Node Path $nodePath from the cache.
This is needed in extremely rare cases: When loading Nodes in the Security Framework, we need to ensure we do not pollute the Node cache, as otherwise these nodes will be found lateron when the actual queries are made.
bool
getChildNodesByPathAndNodeTypeFilter(string $path, string $nodeTypeFilter)
Returns the cached child nodes for the given path and node type filter.
void
setChildNodesByPathAndNodeTypeFilter(string $path, string $nodeTypeFilter, array $nodes)
Sets the given nodes as child nodes for the given path and node type filter.
The nodes will each be added with their path and identifier as well.
void
flush()
Flush the cache.