Class EhcacheHttpCacheStorage

  • All Implemented Interfaces:
    HttpCacheStorage

    public class EhcacheHttpCacheStorage
    extends Object
    implements HttpCacheStorage

    This class is a storage backend for cache entries that uses the popular Ehcache cache implementation. In particular, this backend allows for spillover to disk, where the cache can be effectively larger than memory, and cached responses are paged into and out of memory from disk as needed.

    N.B. Since the Ehcache is configured ahead of time with a maximum number of cache entries, this effectively ignores the maximum cache entries specified by a provided CacheConfig.

    Please refer to the Ehcache documentation for details on how to configure the Ehcache itself.

    Since:
    4.1
    • Constructor Detail

      • EhcacheHttpCacheStorage

        public EhcacheHttpCacheStorage​(net.sf.ehcache.Ehcache cache)
        Constructs a storage backend using the provided Ehcache with default configuration options.
        Parameters:
        cache - where to store cached origin responses
      • EhcacheHttpCacheStorage

        public EhcacheHttpCacheStorage​(net.sf.ehcache.Ehcache cache,
                                       CacheConfig config)
        Constructs a storage backend using the provided Ehcache with the given configuration options.
        Parameters:
        cache - where to store cached origin responses
        config - cache storage configuration options - note that the setting for max object size will be ignored and should be configured in the Ehcache instead.
      • EhcacheHttpCacheStorage

        public EhcacheHttpCacheStorage​(net.sf.ehcache.Ehcache cache,
                                       CacheConfig config,
                                       HttpCacheEntrySerializer serializer)
        Constructs a storage backend using the provided Ehcache with the given configuration options, but using an alternative cache entry serialization strategy.
        Parameters:
        cache - where to store cached origin responses
        config - cache storage configuration options - note that the setting for max object size will be ignored and should be configured in the Ehcache instead.
        serializer - alternative serialization mechanism