Skip to content

Commit 235147f

Browse files
committed
Add some information about bounding the Cache module
1 parent d7d6fdd commit 235147f

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

src/main/xar-resources/data/extensions/extensions.xml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,42 @@
5454
<para>Whilst most extension modules work without any further configuration than that
5555
described above, some modules have additional configuration options. Those additional
5656
options are described in this section.</para>
57+
<sect2 xml:id="module_cache">
58+
<title>Cache Module</title>
59+
<para>This module provides a Global Mutable cache which can be used for manually
60+
caching data. This is often used for caching the results of expensive queries.</para>
61+
<itemizedlist>
62+
<listitem>
63+
<para>Creator: Adam Retter</para>
64+
</listitem>
65+
<listitem>
66+
<para>Licence: LGPL v2</para>
67+
</listitem>
68+
<listitem>
69+
<para>Used: <link xlink:href="https://github.com/ben-manes/caffeine">Caffeine</link></para>
70+
</listitem>
71+
<listitem>
72+
<para>Status: production</para>
73+
</listitem>
74+
<listitem>
75+
<para>Class: <code>org.exist.xquery.modules.cache.CacheModule</code>
76+
</para>
77+
</listitem>
78+
<listitem>
79+
<para>Namespace: <code>http://exist-db.org/xquery/cache</code></para>
80+
</listitem>
81+
</itemizedlist>
82+
<para>
83+
The Cache module can be configured for with a bounded size, or time, or both. eXist-db cannot
84+
know how much memory the data you will put in the cache will take, so it is up to you to
85+
manage your own memory needs here.
86+
</para>
87+
<para>A named cache can either be explicitly created by calling the <code>cache:create</code> XQuery
88+
function, or it can be implicitly created lazing on the first operation performed on the cache.
89+
Configuration of the Cache module is specified within the module definition of eXist-db's
90+
<code>conf.xml</code> file:</para>
91+
<programlisting language="xml" xlink:href="listings/listing-2.xml"/>
92+
</sect2>
5793
<sect2 xml:id="module_sql">
5894
<title>SQL Module</title>
5995
<para>This module provides facilities for performing SQL operations against traditional
@@ -66,7 +102,7 @@
66102
<para>Licence: LGPL v2</para>
67103
</listitem>
68104
<listitem>
69-
<para>Used: JDBC</para>
105+
<para>Used: <link xlink:href="https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/">JDBC</link></para>
70106
</listitem>
71107
<listitem>
72108
<para>Status: production</para>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module class="org.exist.xquery.modules.sql.CacheModule" uri="http://exist-db.org/xquery/cache">
3+
<parameter name="enableLazyCreation" value="true"/> <!-- allow the cache to be created implicitly -->
4+
<parameter name="lazy.maximumSize" value="128"/> <!-- size bound - 128 entries max -->
5+
<parameter name="lazy.expireAfterAccess" value="60000"/> <!-- time bound - 60 seconds -->
6+
</module>

src/main/xar-resources/data/production_good_practice/production_good_practice.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@
336336
You should modify the <tag>builtin-modules</tag> section of
337337
<literal>etc/conf.xml</literal> and <emphasis>only</emphasis> load what
338338
you need for your application.</para>
339+
<para>If you make use of the Cache Module, you should make sure that it has either
340+
a <code>maximumSize</code> or <code>expireAfterAccess</code> bound configured,
341+
this ensures that the Cache can consume all memory.</para>
339342
</listitem>
340343
</varlistentry>
341344
</variablelist>

0 commit comments

Comments
 (0)