Wrapper that sends notifications to other caches in a cluster.
This is used to perform a cluster-global remove(key) or clear() to
prevent caches from returning out of date versions of objects.
Note that cache keys must be serializable.
This package is slightly overcomplicated (more classes than expected)
because I want the factory to be instanciatable, even if jgroups is not
in the classpath.
Wrapper that obtains the desired object from a "MissHandler" if a cache miss occures.
This is a simple way to implement a common usage pattern - that of testing the cache,
if a null is returned then obtain the object, and then add it to the cache. This cache
implements key level locking (synchronization) so the cache will not block while
the miss handler is being called (unless the requests are all for the same object).
The miss handler is asumed to be thead safe, however only one call per key will be made
concurrently.
Wrapper produces a cache that is memory sensitive. Objects that are not in use (directly
referenced) are avalible to the garbage collector. This wrapper is at the mercy of the
VM garbage collector to some extent so be sure to test the behavior in your environment.
Wrapper performs cache level synchronization.
This is used internally by the cache policy factories.
For many of the wrapper cache factories this locking policy is too general,
however for a memory cache I think this is a good approach.
Memory cache operations are very quick, and the cost of performing a cache-global lock
is much less significant that the cost of getting a false negative response from a get.