2.8 XML Document Cache

The document cache holds XML documents recently accessed with fn:doc() by their URI (i.e. documents that were not added explicitly to the database with pf:add-doc()).

Some observations on the XML cache:

  • It is persistent across Mserver sessions.
  • There is a caching policy that determines whether and until when a document that is loaded by an executing XQuery will stay in the cache.
  • An important parameter is the size of the cache. It is controlled by the xquery_cacheMB variable in the MonetDB.conf file (see MonetDB.conf). This value is in megabytes (MB).
  • A general rule is that MonetDB/XQuery always caches file URIs. The system uses the last-modified timestamp of the file system to guarantee that when a query is run, the cached document is actual (if it has changed on disk, the document is removed from the cache automatically, and is shredded anew).
  • Other caching lifetime-rules may be specified to govern the caching of specific URLs. Such rules take the form URLprefix:seconds stating that all URLs starting with URLprefix should be cached for a certain number of seconds. The set of all rules should be concatenated with semi-colons, e.g. http://monetdb.cwi.nl=1600;http://www.slashdot.org=80
  • the current size of the cache can be monitored through the Administrative GUI by clicking "View Database Statistics". The variables xquery_cache_curdocs and xquery_cache_curMB hold respectively the number of documents cached and the total size of the cache in megabytes.
  • when the cache is full, the policy is currently to empty it completely. This is done automatically.