| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>3. 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 10. Caching"><link rel="prev" href="ref_guide_cache_querycomp.html" title="2. Query Compilation Cache"><link rel="next" href="ref_guide_remote.html" title="Chapter 11. 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. |
| Query SQL Cache |
| </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_cache_querycomp.html">Prev</a> </td><th width="60%" align="center">Chapter 10. |
| Caching |
| </th><td width="20%" align="right"> <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. |
| Query SQL Cache |
| </h2></div></div></div><a class="indexterm" name="d0e30448"></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. 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. Plugin Configuration">Section 4, “ |
| Plugin Configuration |
| ”</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="d0e30467"></a><p class="title"><b>Table 10.3. |
| Pre-defined aliases |
| </b></p><div class="table-contents"><table summary="
 Pre-defined aliases
 " 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> </td><td width="20%" align="center"><a accesskey="u" href="ref_guide_caching.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ref_guide_remote.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2. |
| Query Compilation Cache |
| </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 11. |
| Remote and Offline Operation |
| </td></tr></table></div></body></html> |