Overview | Package | Class | Tree | Deprecated | Index | Help
| Kodo 4.1.0 generated on October 9 2006
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## kodo.datacache
Class LRUQueryCache

    java.lang.Object
      org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
          org.apache.openjpa.datacache.AbstractQueryCache
              kodo.datacache.LRUQueryCache

All Implemented Interfaces:
  org.apache.openjpa.datacache.QueryCache, org.apache.openjpa.datacache.TypesChangedListener, org.apache.openjpa.event.RemoteCommitListener, org.apache.openjpa.lib.conf.Configurable, org.apache.openjpa.lib.util.Closeable, org.apache.openjpa.lib.util.EventManager

    public class LRUQueryCache

extends org.apache.openjpa.datacache.AbstractQueryCache
implements org.apache.openjpa.event.RemoteCommitListener

An lru-based query cache.

Field Summary

Fields inherited from class org.apache.openjpa.datacache.AbstractQueryCache
`conf, log`

Constructor Summary
`LRUQueryCache()`

Method Summary
`protected void` | `clearInternal()`
`org.apache.openjpa.util.CacheMap` | `getCacheMap()` Returns the underlying `CacheMap` that this `LRUQueryCache` is using.
`int` | `getCacheSize()` Returns the maximum number of unpinned objects to keep hard references to.
`protected org.apache.openjpa.datacache.QueryResult` | `getInternal(org.apache.openjpa.datacache.QueryKey qk)`
`int` | `getSoftReferenceSize()` Returns the maximum number of unpinned objects to keep soft references to.
`void` | `initialize(org.apache.openjpa.datacache.DataCacheManager mgr)`
`protected Collection` | `keySet()`
`protected boolean` | `pinInternal(org.apache.openjpa.datacache.QueryKey qk)`
`protected org.apache.openjpa.datacache.QueryResult` | `putInternal(org.apache.openjpa.datacache.QueryKey qk, org.apache.openjpa.datacache.QueryResult result)`
`protected org.apache.openjpa.datacache.QueryResult` | `removeInternal(org.apache.openjpa.datacache.QueryKey qk)`
`void` | `setCacheSize(int size)` Sets the maximum number of unpinned objects to keep hard references to.
`void` | `setSoftReferenceSize(int size)` Sets the maximum number of unpinned objects to keep soft references to.
`protected boolean` | `unpinInternal(org.apache.openjpa.datacache.QueryKey qk)`
`void` | `writeLock()`
`void` | `writeUnlock()`

Methods inherited from class org.apache.openjpa.datacache.AbstractQueryCache
`addTypesChangedListener, afterCommit, clear, close, close, endConfiguration, fireEvent, get, isClosed, newListenerCollection, onTypesChanged, pin, put, remove, removeAllInternal, removeTypesChangedListener, setConfiguration, startConfiguration, unpin`

Methods inherited from class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
`addListener, fireEvent, getListeners, hasListener, hasListeners, isFailFast, removeListener, setFailFast`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.openjpa.event.RemoteCommitListener
`afterCommit, close`

Constructor Detail

### LRUQueryCache

    public LRUQueryCache()

Method Detail

### getCacheMap

    public org.apache.openjpa.util.CacheMap getCacheMap()

  Returns the underlying `CacheMap` that this `LRUQueryCache` is using. This is not an unmodifiable view on the map, so care should be taken with this reference. Implementations should probably not mess with the contents of the cache, but should only use this reference to obtain cache metrics. Additionally, this map may contain expired data. Removal of timed-out data is done in a lazy fashion, so the actual size of the map may be greater than the number of non-expired query results in cache.

### getCacheSize

    public int getCacheSize()

  Returns the maximum number of unpinned objects to keep hard references to.

### setCacheSize

    public void setCacheSize(int size)

  Sets the maximum number of unpinned objects to keep hard references to. If the map contains more unpinned objects than `size`, then this method will result in the cache flushing old values.

### getSoftReferenceSize

    public int getSoftReferenceSize()

  Returns the maximum number of unpinned objects to keep soft references to. Defaults to `-1`.

### setSoftReferenceSize

    public void setSoftReferenceSize(int size)

  Sets the maximum number of unpinned objects to keep soft references to. If the map contains more soft references than `size`, then this method will result in the cache flushing values.

### initialize

    public void initialize(org.apache.openjpa.datacache.DataCacheManager mgr)

  Specified by:
    `initialize` in interface `org.apache.openjpa.datacache.QueryCache`
  Overrides:
    `initialize` in class `org.apache.openjpa.datacache.AbstractQueryCache`

### writeLock

    public void writeLock()

  Specified by:
    `writeLock` in interface `org.apache.openjpa.datacache.QueryCache`

### writeUnlock

    public void writeUnlock()

  Specified by:
    `writeUnlock` in interface `org.apache.openjpa.datacache.QueryCache`

### getInternal

    protected org.apache.openjpa.datacache.QueryResult getInternal(org.apache.openjpa.datacache.QueryKey qk)

  Specified by:
    `getInternal` in class `org.apache.openjpa.datacache.AbstractQueryCache`

### putInternal

    protected org.apache.openjpa.datacache.QueryResult putInternal(org.apache.openjpa.datacache.QueryKey qk,
                                                                   org.apache.openjpa.datacache.QueryResult result)

  Specified by:
    `putInternal` in class `org.apache.openjpa.datacache.AbstractQueryCache`

### removeInternal

    protected org.apache.openjpa.datacache.QueryResult removeInternal(org.apache.openjpa.datacache.QueryKey qk)

  Specified by:
    `removeInternal` in class `org.apache.openjpa.datacache.AbstractQueryCache`

### clearInternal

    protected void clearInternal()

  Specified by:
    `clearInternal` in class `org.apache.openjpa.datacache.AbstractQueryCache`

### pinInternal

    protected boolean pinInternal(org.apache.openjpa.datacache.QueryKey qk)

  Specified by:
    `pinInternal` in class `org.apache.openjpa.datacache.AbstractQueryCache`

### unpinInternal

    protected boolean unpinInternal(org.apache.openjpa.datacache.QueryKey qk)

  Specified by:
    `unpinInternal` in class `org.apache.openjpa.datacache.AbstractQueryCache`

### keySet

    protected Collection keySet()

  Specified by:
    `keySet` in class `org.apache.openjpa.datacache.AbstractQueryCache`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Kodo 4.1.0 generated on October 9 2006
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001-2006 BEA Systems, Inc. All Rights Reserved.