| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>2. Query Compilation Cache</title><base href="display"><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="manual.html" title="Apache OpenJPA 2.2 User's Guide"><link rel="up" href="ref_guide_caching.html" title="Chapter 10. Caching"><link rel="prev" href="ref_guide_caching.html" title="Chapter 10. Caching"><link rel="next" href="ref_guide_cache_querysql.html" title="3. 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. |
| Query Compilation Cache |
| </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_caching.html">Prev</a> </td><th width="60%" align="center">Chapter 10. |
| Caching |
| </th><td width="20%" align="right"> <a accesskey="n" href="ref_guide_cache_querysql.html">Next</a></td></tr></table><hr></div><div class="section" title="2. Query Compilation Cache"><div class="titlepage"><div><div><h2 class="title" style="clear: both" id="ref_guide_cache_querycomp">2. |
| Query Compilation Cache |
| </h2></div></div></div> |
| |
| <a class="indexterm" name="d5e16220"></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. 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. 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="d5e16229"></a><p class="title"><b>Table 10.2. |
| Pre-defined aliases |
| </b></p><div class="table-contents"> |
| |
| <table summary="
 Pre-defined aliases
 " 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> </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_cache_querysql.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 10. |
| Caching |
| </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> 3. Prepared SQL Cache</td></tr></table></div></body></html> |