[
https://issues.apache.org/jira/browse/OPENJPA-1378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rick Curtis resolved OPENJPA-1378.
----------------------------------
Fix Version/s: 2.1.0
Resolution: Fixed
Committed revision 964097 to trunk.
> Provide LRU option for L2 data cache
> ------------------------------------
>
> Key: OPENJPA-1378
> URL: https://issues.apache.org/jira/browse/OPENJPA-1378
> Project: OpenJPA
> Issue Type: Improvement
> Components: datacache
> Reporter: Thomas O Rowe
> Assignee: Rick Curtis
> Priority: Minor
> Fix For: 2.1.0
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Default data cache operation when it is full is to randomly toss an entity.
> For queries that return >1 entity, this means the most recent query is not
> guaranteed to be cached in its entirety.
> Jeremy provided this code to me which certainly works, and should be
> integrated into the base data cache support...
> 1) Create a new plugin class: (bundle it with your test app)
> package test;
> import org.apache.openjpa.datacache.AbstractDataCache;
> import org.apache.openjpa.datacache.ConcurrentDataCache;
> import org.apache.openjpa.util.CacheMap;
> public class TomsCache extends ConcurrentDataCache {
> protected CacheMap newCacheMap() {
> return new CacheMap(true, 1000) {
> protected void entryRemoved(Object key, Object value,
> boolean expired) {
> keyRemoved(key, expired);
> }
> };
> }
> }
> 2) Enable your plugin using a persistence property.
> <property name="openjpa.DataCache" value="test.TomsCache(CacheSize=5,
> SoftReferenceSize=0)"/>
> The oldest entry should get evicted first.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.