XQuery Function Documentation

Search and Browse

http://exist-db.org/xquery/cache

java:org.exist.xquery.modules.cache.CacheModule

A module for accessing global caches for sharing data between concurrent sessions

cache:cleanup

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.

Parameters:
$cache-name The name of the cache
Returns:
empty-sequence()

cache:clear

cache:clear() as empty-sequence()

Clears all key/values from either all caches or the named cache

Returns:
empty-sequence()

cache:clear

cache:clear($cache-name as xs:string) as empty-sequence()

Clears all key/values from either all caches or the named cache

Parameters:
$cache-name The name of the cache
Returns:
empty-sequence()

cache:create

cache:create($cache-name as xs:string, $config as map(*)) as xs:boolean

Explicitly create a cache with a specific configuration

Parameters:
$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"} }
Returns:
xs:boolean : true if the cache was created, false if the cache already exists

cache:destroy

cache:destroy($cache-name as xs:string) as empty-sequence()

Destroys a cache entirely

Parameters:
$cache-name The name of the cache
Returns:
empty-sequence()

cache:get

cache:get($cache-name as xs:string, $key as xs:anyType+) as item()*

Get data from identified global cache by key

Parameters:
$cache-name The name of the cache
$key+ The key
Returns:
item()* : The value associated with the key

cache:keys

cache:keys($cache-name as xs:string) as xs:string*

List all keys stored in a cache. Note this operation is expensive.

Parameters:
$cache-name The name of the cache
Returns:
xs:string* : The keys in the cache. Note these will be returned in serialized string form, as that is used internally.

cache:list

cache:list($cache-name as xs:string, $keys as xs:anyType*) as item()*

List all values (for the associated keys) stored in a cache.

Parameters:
$cache-name The name of the cache
$keys* The keys, if none are specified, all values are returned
Returns:
item()* : The values associated with the keys

cache:names

cache:names() as xs:string*

Get the names of all current caches

Returns:
xs:string* : The names of all caches currently in use.

cache:put

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

Parameters:
$cache-name The name of the cache
$key+ The key
$value* The value
Returns:
item()* : The previous value associated with the key

cache:remove

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

Parameters:
$cache-name The name of the cache
$key+ The key
Returns:
item()* : The value that was previously associated with the key