A module for accessing global caches for sharing data between concurrent sessions
cache:cleanup($cache-name as xs:string) as empty-sequence()
Eviction policy work of the cache is performed asynchronously. Performs any pending maintenance operations needed by the cache, on the current thread. Typically not needed by users, and only used for testing scenarios. Requires 'clear' permissions.
$cache-name | The name of the cache |
cache:clear() as empty-sequence()
Clears all key/values from either all caches or the named cache
cache:clear($cache-name as xs:string) as empty-sequence()
Clears all key/values from either all caches or the named cache
$cache-name | The name of the cache |
cache:create($cache-name as xs:string, $config as map(*)) as xs:boolean
Explicitly create a cache with a specific configuration
$cache-name | The name of the cache |
$config | A map with configuration for the cache. At present cache LRU and permission groups may be specified, for operations on the cache. `maximumSize` is optional and specifies the maximum number of entries. `expireAfterAccess` is optional and specifies the expiry period for infrequently accessed entries (in milliseconds). If a permission group is not specified for an operation, then permissions are not checked for that operation. Should have the format: map { "maximumSize": 1000, "expireAfterAccess": 120000, "permissions": map { "put-group": "group1", "get-group": "group2", "remove-group": "group3", "clear-group": "group4"} } |
cache:destroy($cache-name as xs:string) as empty-sequence()
Destroys a cache entirely
$cache-name | The name of the cache |
cache:get($cache-name as xs:string, $key as xs:anyType+) as item()*
Get data from identified global cache by key
$cache-name | The name of the cache |
$key+ | The key |
cache:keys($cache-name as xs:string) as xs:string*
List all keys stored in a cache. Note this operation is expensive.
$cache-name | The name of the cache |
cache:list($cache-name as xs:string, $keys as xs:anyType*) as item()*
List all values (for the associated keys) stored in a cache.
$cache-name | The name of the cache |
$keys* | The keys, if none are specified, all values are returned |
cache:names() as xs:string*
Get the names of all current caches
cache:put($cache-name as xs:string, $key as xs:anyType+, $value as item()*) as item()*
Put data with a key into the identified cache. Returns the previous value associated with the key
$cache-name | The name of the cache |
$key+ | The key |
$value* | The value |
cache:remove($cache-name as xs:string, $key as xs:anyType+) as item()*
Remove data from the identified cache by the key. Returns the value that was previously associated with key
$cache-name | The name of the cache |
$key+ | The key |