
JPOX is developed as a plugin-driven framework and one of the components that is pluggable is the Level 1 caching
of objects (between PersistenceManagers for the same PersistenceManagerFactory). JPOX provides
three Level 1 caches but is structured so that you can easily add your own variant
and have it usable within your JPOX usage.
This is available in JPOX from version 1.1.3
The following sections describe how to create your own Level 1 cache plugin for JPOX.
If you have your own Level1 cache you can easily use it with JPOX.
JPOX defines a Level1Cache interface and you need to implement this.
package org.jpox.cache;
public interface Level1Cache extends Map
{
}
So you need to create a class, MyLevel1Cache for example, that implements this interface (i.e
that implements java.util.Map).
Once you have this implementation you then need to make the class available as a JPOX plugin.
You do this by putting a file plugin.xml in your JAR either at the root of the CLASSPATH
or at META-INF/plugins/. The file plugin.xml will look like this
<?xml version="1.0"?>
<plugin id="mydomain.mycache" name="JPOX plug-ins" provider-name="My Company">
<extension point="org.jpox.cache_level1">
<cache name="MyCache" class-name="mydomain.MyLevel1Cache"/>
</extension>
</plugin>
The only thing remaining is to use your L1 Cache plugin. To do this you specify the
PersistenceManagerFactory property org.jpox.cache.level1.type
as MyCache (the "name" in plugin.xml).