Database Reference
In-Depth Information
Namespace
The namespace for the module, including the preferred prefix. You can, of course,
decide to use a different prefix.
Type/default status
The type of the module (Java or XQuery), and whether it is enabled by default and
(for Java modules) built into eXist. Information about what this means exactly and
how to change it can be found in “Enabling Extension Modules” on page 128 .
Class
The Java class name (for Java-based modules) or the location (for XQuery-based
modules) of the module.
cache
Description
Systemwide global cache
Namespace
cache="http://exist-db.org/xquery/cache"
Type/default status
Java; enabled in $EXIST_HOME/conf.xml ; enabled in $EXIST_HOME/extensions/
build.properties
Class
org.exist.xquery.modules.cache.CacheModule
The cache extension module adds a systemwide global cache to eXist. It allows you to
create data that is not only sessionwide (for which you would use the session mod‐
ule) but also systemwide. It adds true global variables to eXist, with all the benefits
but also the ugly dangers of global data.
The following example creates a cache (or gets a reference to it if it already exists) and
stores the current date/time in it. The cache:put function returns the previous value,
which we display alongside the new value:
let $ cache := cache:cache ( 'test' )
let $ previous-value := cache:put ( 'test' , 'KEY' , current-dateTime ())
return
<cache previous = "{ $ previous-value }" now = "{ cache:get ( 'test' , 'KEY' )}" />
If you run this example from different sessions (run it, close your browser, run it
again), you'll find that the value stored is retained: the now value from the first session
is the previous value in the second session.
 
Search WWH ::




Custom Search