Home | License | API Docs
Summary | Download
ShiftOne

ShiftOne Java Object Cache Wrappers

Statistical
JMX (MBean)
Clustered (JGroups and JMS)
Miss Handler
Memory Sensitive (Soft)
Tandem
Synchronized

Statistical

The Stat cache intercepts calls to an underlying delegate cache. It counts calls to the delegate, and tracks the hit/miss ratio. When the application shuts down, the Stat cache will emit a log file containing these statistics. This cache can be useful when choosing a cache policy and configuration for a particular use.

JMX (MBean)

The JMX cache registers an MBean for each cache with an MBeanServer. Each MBean allows usage and hit/miss statistics to be viewed using any JMX Console. In addition, the MBean allows the cache and the statistics to be cleared at runtime.

For J2EE applications where there is an available Servlet container, the Web Based EJTools JMX Browser is an excellent tool.

Clustered (JGroups and JMS)

The cluster wrapper distributes calls to clear() and remove() to a equivalent (having the same name) cache's in a cluster. This helps nodes of a cluster to prevent stale data from being returned from a cache. The idea is - that when one cache updates an object, it will explicitly call clear on the cache to remove the old version.

This wrapper does not keep the content of a cache in sync. Adds and gets are not distributed - cache's are NOT replicated.

This wrapper uses JGroups or JMS to distribute messages to nodes of the cluster. If you want to use JMS, you should read this Clustering with JMS

Miss Handler

The usage pattern for a cache is very simple and consistent. When using a cache, an application will typically check the cache before it performs an expensive operation to obtain an object. The goal of course is to avoid spending time and resources obtaining a unchanging result multiple times.

Now that you know what a cache is :) - the Miss Handler Cache helps to implement this usage pattern. To use it, you must implement the MissHandler interface. When this wrapper cache is asked for an object it doesn't have, it redirects that request to the your MissHandler.

The miss handler performs key level locking to ensure that two threads requesting the same key at approximately the same time will not initiate two requests to the MissHandler.

Memory Sensitive (Soft)

This wrapper prevents the a cache from preventing the objects in it from being garbage collected. To put it another way - objects added to the cache will be available for garbage collection.

Whenever an object is added to the Soft Cache, the wrapper adds a SoftReference to the underlying delegate cache. When retrieving an object, it transparently dereferences the reference.

Tandem

This wrapper creates a cache that delegates to two (or more) cache instances. This wrapper, in conjunction with the Statistical wrapper is a good way to pit two cache policies against each other for testing.

Synchronized

This wrapper enforces cache level thread synchronization.

ShiftOne Object Cache 2.1

SourceForge.net Logo
page regenerated
© Jeff Drost