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

cleanup

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()

clear

clear() as empty-sequence()

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

Returns:
empty-sequence()

clear

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()

create

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 specified 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

destroy

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

Destroys a cache entirely

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

get

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

keys

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.

list

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

names

names() as xs:string*

Get the names of all current caches

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

put

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

remove

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