Class CacheFactory


  • public final class CacheFactory
    extends Object
    Factory used to obtain Cache instance and to register the CacheProvider that is used to obtain that.
    Since:
    1.1
    Author:
    Arjan Tijms
    • Method Detail

      • getCache

        public static Cache getCache​(FacesContext context,
                                     String scope)
        Gets an instance of a Cache using the configured cache provider.
        Parameters:
        context - faces context used for retrieving the cache provider and 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.
        Returns:
        a cache provider specific Cache instance
      • getCacheProvider

        public static CacheProvider getCacheProvider​(ServletContext servletContext)
        Gets the cache provider as it has been set in the ServletContext. Does NOT return the default cache provider if none is present.
        Parameters:
        servletContext - the servlet context where the cache provider is retrieved from
        Returns:
        the previously set provider if one is set, null otherwise
      • getCacheProvider

        public static CacheProvider getCacheProvider​(FacesContext context)
        Gets the cache provider that has been set, or the default provider if none is present.
        Parameters:
        context - the faces context where the cache provider is retrieved from
        Returns:
        the previously set provider if one is set, otherwise the default provider