JPOX
JPOX
 Project  |  Ver 1.1  |  Ver 1.2  |  JDO  |  JPA  |  Guides  |  Tools
1.1 | Preparation | O/R Mapping | Runtime | Extensions | Developer
Development
Testing
Caching in JPOX
JDO

JPOX's cache implementation meets the requirements of the JDO 1 and JDO 2 specifications. It provides a Level 1 cache, and additionally provides a Level 2 cache that conforms to the DataStoreCache interface (JDO 2). The Level 1 Cache exists in the PersistenceManager. This is always enabled in JDO implementations. The Level 2 Cache exists in the PersistenceManagerFactory and is shared across PersistenceManager's. This is not currently enabled by default, but is enabled via PMF properties.

JPOX Level 1 Cache

The Level 1 cache is provided by way of an interface Level1Cache that is based on Map. It provides 3 implementations of this that the user can select. These are WeakRefCache, SoftRefCache, and HardRefCache. They have differing backing stores based around whether the objects stored in the cache is free to be garbage collected easily.



JPOX

The Level 2 cache is provided by way of an interface Level2Cache that extends the JDO 2 DataStoreCache definition. JPOX provides 2 implementations for this. The default is the suitably named DefaultLevel2Cache. This provides a cache using 2 maps internally. One map stores objects as weak references, and the other stores objects as strong references. This allows the JDO 2 capability to pin and unpin objects in the cache.

The Level 2 Cache is enabled by way of the property org.jpox.cache.type2 being set to true. JPOX provides an alternative to the default for users who have access to Tangosol Coherence. This provides the capability to have a distributed cache.