Interface CacheWrapper


  • public interface CacheWrapper
    Wraps a cache in order to add functionality like tracing. The cache wrapper is called after a cache is build and may wrap a cache instance. The {@link org.cache2k.Cache2kBuilder@#build} and CacheManager.getCache(String) will return the wrapped cache instead of the original. Depending on the configuration the wrapper may also decide to just return the original cache instance.

    The configuration allows specifying two different wrappers. One for tracing Cache2kConfig.setTraceCacheWrapper(CacheWrapper) and one for general use Cache2kConfig.setCacheWrapper(CacheWrapper). The wrapping is applied in that order, with tracing first.

    To wrap a Cache the base classes AbstractCache or ForwardingCache are available.

    Author:
    Jens Wilke