cache

Function: cache()

Build and use a set of values across the records in a stream set.

The first parameter is the cache key expression. This is evaluated and the result used as the key value for the cache. Before the subsequent expressions are evaluated the key value is used to retrieve the current value from the cache associated with that key. This retrieved value is then assigned to the internal variable _cacheValue. If there was no value in the cache for this key then _cacheValue is set to _NULL.

This cache key expression is followed by a number of additional expressions. These are evaluated in turn, and the value returned by the final expression is placed into the cache against the original key value.

The final cache value is returned by the expression.

Please not that the internal variable _cacheValue should not be used outside of the cache function.

Syntax

cache(cache key, expression1, expression2, [,..., expressionN])

ArgumentTypeDescription
cache keyExpressionAny valid Expression
expressionNExpressionAny valid Expression

Examples

$result = cache("accountRef", _cacheValue + 1)

Get the cache value for key value "accountRef", add one to this and write this back to the cache. Finally return the new cache value associated with this key and assign it to the variable $result.

cache("accoutRef")

Return the cache value for key value "accountRef".

See Also