blob: 65f752f92e81770f3201576969b9c855918b17bd [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>3.&nbsp; Query SQL Cache</title><link rel="stylesheet" href="css/docbook.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="manual.html" title="Apache OpenJPA User's Guide"><link rel="up" href="ref_guide_caching.html" title="Chapter&nbsp;10.&nbsp; Caching"><link rel="prev" href="ref_guide_cache_querycomp.html" title="2.&nbsp; Query Compilation Cache"><link rel="next" href="ref_guide_remote.html" title="Chapter&nbsp;11.&nbsp; Remote and Offline Operation"></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">3.&nbsp;
Query SQL Cache
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_cache_querycomp.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_remote.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref_guide_cache_querysql"></a>3.&nbsp;
Query SQL Cache
</h2></div></div></div><a class="indexterm" name="d0e30308"></a><p>
The query SQL cache is a <code class="classname">Map</code> used to cache
pushed-down SQL query strings for the find operation. As a result,
the SQL queries are only generated once in OpenJPA, and cached thereafter.
This query SQL cache is shared across entity managers and the fetch plan
is part of the cache key. You can control the SQL cache through
the <a href="ref_guide_conf_jdbc.html#openjpa.jdbc.QuerySQLCache" title="6.10.&nbsp; openjpa.jdbc.QuerySQLCache"><code class="literal">
openjpa.jdbc.QuerySQLCache</code></a> configuration property. This
property accepts a plugin string (see <a 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"><a name="d0e30327"></a><p class="title"><b>Table&nbsp;10.3.&nbsp;
Pre-defined aliases
</b></p><div class="table-contents"><table summary="&#xA; Pre-defined aliases&#xA; " border="1"><colgroup><col align="left"><col align="left"></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 xmlns:xlink="http://www.w3.org/1999/xlink" href="../javadoc/org/apache/openjpa/util/CacheMap.html" target="_top">
<code class="literal">CacheMap</code></a> to store sql string.
<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 sql string 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 sql 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_cache_querycomp.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_remote.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.&nbsp;
Query Compilation Cache
&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;11.&nbsp;
Remote and Offline Operation
</td></tr></table></div></body></html>