GetAdhocCached (open)

Get a value from cachegetter, first looking at a cache (every calling whlib has its own cache)

Syntax

LOADLIB "wh::adhoccache.whlib";

VARIANT FUNCTION GetAdhocCached(RECORD cachetag, MACRO PTR cachegetter, RECORD options)

Parameters

RECORD cachetag

Tag that uniquely identifies the result (local per calling whlib)

MACRO PTR cachegetter

Function that generates the return value if no cache entry is present. Signature RECORD FUNCTION()

return

Value to return and caching instructions

STRING ARRAY return.eventmasks

List of events that invalidate the cached value

INTEGER return.ttl

Time to live in milliseconds. A DATETIME can also be used to specify an expact expiry date. Use 0 or DEFAULT DATETIME to return the value without storing it in the cache.

return.value

Value to return

RECORD options

Options

exclusive

Use a lock to ensure only one call to the cachecatter is run in parallel for his cachetag. Defaults to TRUE

Return value

VARIANT

Returns the value in cache (or the value cell from the cachegetter call if not in cache)