Class CacheInstancePerScopeProvider

  • All Implemented Interfaces:
    Direct Known Subclasses:

    public abstract class CacheInstancePerScopeProvider
    extends Object
    implements CacheProvider
    Base class for Cache providers where for each scope a new instance of the cache is created if for that scope no instance is present yet.

    This kind of cache provider is suitable for simple in-memory cache implementations, where the cache is very cheap to create. This is in contrast to caches where there is typically one expensive to create instance active per JVM, and where scoped caches are better expressed as nodes in a tree structure.

    Arjan Tijms
    • Constructor Detail

      • CacheInstancePerScopeProvider

        public CacheInstancePerScopeProvider()
    • Method Detail

      • getCache

        public Cache getCache​(FacesContext context,
                              String scope)
        Description copied from interface: CacheProvider
        Gets an instance of a Cache using the configured cache provider.
        Specified by:
        getCache in interface CacheProvider
        context - faces context used for resolving the given scope.
        scope - scope for which the cache should be obtained. Supported scopes are dependent on the specific caching provider, but generally at least "session" and "application" should be supported.
        Cache instance encapsulating the cache represented by this CacheProvider
      • setParameters

        public void setParameters​(Map<String,​String> parameters)
        Description copied from interface: CacheProvider
        Passes parameters to the cache provider implementation. This is mainly intended for configuration of things like LRU and global TTL. Settings are mainly implementation specific.
        Specified by:
        setParameters in interface CacheProvider
        parameters - map of parameters used to configure the cache.
      • createCache

        protected abstract Cache createCache​(Integer timeToLive,
                                             Integer maxCapacity)