class CacheLifetimeOperation extends AbstractOperation (View source)

"cacheLifetime" operation working on ContentRepository nodes. Will get the minimum of all allowed cache lifetimes for the nodes in the current FlowQuery context. This means it will evaluate to the nearest future value of the hiddenBeforeDateTime or hiddenAfterDateTime properties of all nodes in the context. If none are set or all values are in the past it will evaluate to NULL.

To include already hidden nodes (with a hiddenBeforeDateTime value in the future) in the result, also invisible nodes have to be included in the context. This can be achieved using the "context" operation before fetching child nodes.

Example:

q(node).context({'invisibleContentShown': true}).children().cacheLifetime()

Properties

static protected string $shortName {@inheritdoc}
static protected int $priority {@inheritdoc}
static protected bool $final {@inheritdoc}
protected Now $now

Methods

bool
canEvaluate(array $context)

{@inheritdoc}

int
evaluate(FlowQuery $flowQuery, array $arguments)

{@inheritdoc}

Details

bool canEvaluate(array $context)

{@inheritdoc}

Parameters

array $context

$context onto which this operation should be applied (array or array-like object)

Return Value

bool

true if the operation can be applied onto the $context, false otherwise

int evaluate(FlowQuery $flowQuery, array $arguments)

{@inheritdoc}

Parameters

FlowQuery $flowQuery

The FlowQuery object

array $arguments None

Return Value

int

The cache lifetime in seconds or NULL if either no content collection was given or no child node had a "hiddenBeforeDateTime" or "hiddenAfterDateTime" property set