class CachingHelper implements ProtectedContextAwareInterface (View source)

Caching helper to make cache tag generation easier.

Methods

array
convertArrayOfNodesToArrayOfNodeIdentifiersWithPrefix(mixed $nodes, string $prefix)

Render a caching configuration for array of Nodes

array
nodeTag(mixed $nodes)

Generate a @cache entry tag for a single node, array of nodes or a FlowQuery result A cache entry with this tag will be flushed whenever one of the given nodes (for any variant) is updated.

string
nodeTagForIdentifier(string $identifier, NodeInterface $contextNode = null)

Generate a @cache entry tag for a single node identifier. If a NodeInterface $contextNode is given the entry tag will respect the workspace hash.

string|string[]
nodeTypeTag(string|NodeType|string[]|NodeType[] $nodeType, NodeInterface|null $contextNode = null)

Generate an @cache entry tag for a node type A cache entry with this tag will be flushed whenever a node (for any variant) that is of the given node type(s) (including inheritance) is updated.

string
getNodeTypeTagFor(string|NodeType $nodeType, $contextNode = null)

No description

array
descendantOfTag(mixed $nodes)

Generate a @cache entry tag for descendants of a node, an array of nodes or a FlowQuery result A cache entry with this tag will be flushed whenever a node (for any variant) that is a descendant (child on any level) of one of the given nodes is updated.

string
renderWorkspaceTagForContextNode(string $workspaceName)

No description

bool
allowsCallOfMethod(string $methodName)

All methods are considered safe

Details

protected array convertArrayOfNodesToArrayOfNodeIdentifiersWithPrefix(mixed $nodes, string $prefix)

Render a caching configuration for array of Nodes

Parameters

mixed $nodes
string $prefix

Return Value

array

Exceptions

Exception

array nodeTag(mixed $nodes)

Generate a @cache entry tag for a single node, array of nodes or a FlowQuery result A cache entry with this tag will be flushed whenever one of the given nodes (for any variant) is updated.

Parameters

mixed $nodes

(A single Node or array or \Traversable of Nodes)

Return Value

array

Exceptions

Exception

string nodeTagForIdentifier(string $identifier, NodeInterface $contextNode = null)

Generate a @cache entry tag for a single node identifier. If a NodeInterface $contextNode is given the entry tag will respect the workspace hash.

Parameters

string $identifier
NodeInterface $contextNode

Return Value

string

string|string[] nodeTypeTag(string|NodeType|string[]|NodeType[] $nodeType, NodeInterface|null $contextNode = null)

Generate an @cache entry tag for a node type A cache entry with this tag will be flushed whenever a node (for any variant) that is of the given node type(s) (including inheritance) is updated.

Parameters

string|NodeType|string[]|NodeType[] $nodeType
NodeInterface|null $contextNode

Return Value

string|string[]

protected string getNodeTypeTagFor(string|NodeType $nodeType, $contextNode = null)

No description

Parameters

string|NodeType $nodeType
$contextNode

Return Value

string

array descendantOfTag(mixed $nodes)

Generate a @cache entry tag for descendants of a node, an array of nodes or a FlowQuery result A cache entry with this tag will be flushed whenever a node (for any variant) that is a descendant (child on any level) of one of the given nodes is updated.

Parameters

mixed $nodes

(A single Node or array or \Traversable of Nodes)

Return Value

array

Exceptions

Exception

string renderWorkspaceTagForContextNode(string $workspaceName)

No description

Parameters

string $workspaceName

Return Value

string

bool allowsCallOfMethod(string $methodName)

All methods are considered safe

Parameters

string $methodName

Return Value

bool