JPOX
JPOX
 JPOX Version 1.0
Configuration | Tutorials | Worked Examples | Developer
Obtaining JPOX
JPOX Preparation
JPOX Runtime
JPOX Caching

JDO defines levels of caching that are appropriate for an implementation. JPOX provides a facility for caching that meets the specification, but in addition allows the use of third party caching tools (such as Tangosol Coherence, OSCache, etc).

There are 3 levels of caching available with JPOX.

  • Level 1 Cache - this is mandated by the JDO specification, and represents the caching of JDO instances within a PersistenceManager.
  • Level 2 Cache - this represents the caching of JDO instances within a PersistenceManagerFactory (across multiple PersistenceManager's)
  • Level 3 Cache - this represents the caching of JDO instances across multiple PersistenceManagerFactory's. This is not very common in JDO.


JPOX Internal Caching

By default in JPOX, Level 1 Cache is enabled. The user can configure Level 2 Cache and also Level 3 Cache if they so wish. These are defined by use of the PersistenceManagerFactory property

  • org.jpox.cache.jdoinstances.group - this defines the group that this PersistenceManagerFactory is part of. If multiple PersistenceManagerFactory's are defined in the same group, they will be cached with Level 3 Caching. If no group is defined then Level 2 and Level 3 cache are not enabled.

So if a PersistenceManagerFactory has a org.jpox.cache.jdoinstances.group defined, it will have Level 2 caching, and if there are more than 1 PersistenceManagerFactory object with the same value, then they will have Level 3 caching.

You have one additional control over the JPOX internal cache behaviour. This is achieved by use of the PersistenceManagerFactory property

  • org.jpox.cache.jdoinstances.plugin - if you specify org.jpox.cache.WeakRefCache (the default) all JDO instances in the cache will be stored using weak references. Alternatively if you specify org.jpox.cache.SoftRefCache all JDO instances will be stored with soft references (like weak references except that they can be garbage collected when necessary).


External Caching

As mentioned above, external caching products can be used with JPOX. These are specified by use of a cache plugin. This is specified by way of a PersistenceManagerFactory property org.jpox.cache.jdoinstances.plugin, which specifies the class name of the plugin. The plugin provides an interface to the external product.

It is planned to write plugins for the majority of external products available. In the meantime you can always write your own plugin to interface with your caching solution.