How is a cache obtained?
This cache implementation strives to abstract from an application, the
concrete implementation and configuration of a cache. For this reason,
cache's should be accessed exclusively using the "Cache" interface
(cache policies are not public classes, so this is required).
Both caches and cache factories may be obtained from a cache configuration.
A cache configuration allows mnemonic names to be associated with
various cache and factory configurations.
If an application absolutely needs to programmatically set the max size and
timeout of a cache, then a cache factory should be obtained from the config
first, and used to create a cache.
If an application's requirements allow, all properties of a cache may be
externalized to the cache configuration. This approach is far more
powerful (and recommended).
How does this cache perform?
Performace depends a great deal on configuration, as well as how
the cache is being used (size, hit frequency, etc).
Benchmarking is a complex task, and it
is extremely difficult (if not impossible) to make a claim that
one cache is faster than another.
That said, the author of this cache (Jeff Drost) is also the author
of JRat, a java performance profiling
tool which he has used in tuning the performance of the policy cache
implementations (case study anyone?). He believes the implementation
is a good balance of efficiency and features.
The full source distribution of this cache contains a benchmark tool,
as well as several other popular quality cache implementations.
Give it a run, or take a look at some
benchmark results.