cache

Function

ArgDescriptionType
funcA function to evaluateLazyExpr (required)
nameThe global name of this cache (needed when more than one)string
keyCache key to use.string (required)
periodThe latest age of the cache.int64

Description

Creates a cache object.

A Cache is a data structure which is used to speed up calculating data by keeping it’s value in memory. A cache is essentially a key value store - when the key is accessed, the function will be calculated producing a value. If the key is accessed again, the value is returned from the cache without calculating it again.

For example consider the following:

    LET get_pid_query(Lpid) =
       SELECT Pid, Ppid, Name FROM pslist(pid=Lpid)

    SELECT cache(func=get_pid_query(Lpid=Pid), key=str(str=Pid))
    FROM ....

The cache will ensure that get_pid_query() is only called once per unique Pid by comparing the key against the internal memory store.