blob: a305aab407391966a2c7dd4710d480cf975f251a [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>2.&nbsp; Query Compilation Cache</title><base href="display"><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="manual.html" title="Apache OpenJPA 2.4 User's Guide"><link rel="up" href="ref_guide_caching.html" title="Chapter&nbsp;10.&nbsp; Caching"><link rel="prev" href="ref_guide_caching.html" title="Chapter&nbsp;10.&nbsp; Caching"><link rel="next" href="ref_guide_cache_querysql.html" title="3.&nbsp;Prepared SQL Cache"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.&nbsp;
Query Compilation Cache
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_caching.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;10.&nbsp;
Caching
</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ref_guide_cache_querysql.html">Next</a></td></tr></table><hr></div><div class="section" id="ref_guide_cache_querycomp"><div class="titlepage"><div><div><h2 class="title" style="clear: both">2.&nbsp;
Query Compilation Cache
</h2></div></div></div>
<a class="indexterm" name="d5e16350"></a>
<p>
The query compilation cache is a <code class="classname">Map</code> used to cache
parsed query strings. As a result, most queries are only parsed once in
OpenJPA, and cached thereafter. You can control the compilation cache through
the <a class="link" href="ref_guide_conf_openjpa.html#openjpa.QueryCompilationCache" title="5.59.&nbsp; openjpa.QueryCompilationCache"><code class="literal">
openjpa.QueryCompilationCache</code></a> configuration property. This
property accepts a plugin string (see <a class="xref" href="ref_guide_conf_plugins.html" title="4.&nbsp; Plugin Configuration">Section&nbsp;4, &#8220;
Plugin Configuration
&#8221;</a>)
describing the <code class="classname">Map</code> used to associate query strings and
their parsed form. This property accepts the following aliases:
</p>
<div class="table" id="d5e16359"><p class="title"><b>Table&nbsp;10.2.&nbsp;
Pre-defined aliases
</b></p><div class="table-contents">
<table summary="&#xA; Pre-defined aliases&#xA; " border="1"><colgroup><col align="left" class="alias"><col align="left" class="value"><col align="left" class="notes"></colgroup><thead><tr><th align="left">Alias</th><th align="left">Value</th><th align="left">Notes</th></tr></thead><tbody><tr><td align="left">
<code class="literal">true</code>
</td><td align="left">
<code class="literal">org.apache.openjpa.util.CacheMap</code>
</td><td align="left">
The default option. Uses a
<a class="ulink" href="../javadoc/org/apache/openjpa/util/CacheMap.html" target="_top">
<code class="literal">CacheMap</code></a> to store compilation data.
<code class="literal">CacheMap</code> maintains a fixed number of cache entries, and an
optional soft reference map for entries that are moved out of the LRU space.
So, for applications that have a monotonically increasing number of distinct
queries, this option can be used to ensure that a fixed amount of memory is
used by the cache.
</td></tr><tr><td align="left"><code class="literal">all</code></td><td align="left">
<code class="literal">org.apache.openjpa.lib.util.ConcurrentHashMap</code>
</td><td align="left">
This is the fastest option, but compilation data is never dropped from the
cache, so if you use a large number of dynamic queries, this option may result
in ever-increasing memory usage. Note that if your queries only differ in the
values of the parameters, this should not be an issue.
</td></tr><tr><td align="left"><code class="literal">false</code></td><td align="left"><span class="emphasis"><em>none</em></span></td><td align="left">
Disables the compilation cache.
</td></tr></tbody></table>
</div></div><br class="table-break">
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ref_guide_caching.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ref_guide_caching.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ref_guide_cache_querysql.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;10.&nbsp;
Caching
&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;3.&nbsp;Prepared SQL Cache</td></tr></table></div></body></html>