java.lang.Object
org.omnifaces.util.cache.CacheFactory
Factory used to obtain
Cache instance and to register the CacheProvider that is used to obtain that.- Since:
- 1.1
- Author:
- Arjan Tijms
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic CachegetCache(FacesContext context, String scope) Gets an instance of a Cache using the configured cache provider.static CacheProvidergetCacheProvider(FacesContext context) Gets the cache provider that has been set, or the default provider if none is present.static CacheProvidergetCacheProvider(ServletContext servletContext) Gets the cache provider as it has been set in the ServletContext.static CacheProviderReturns an instance of the default cache provider.static voidsetCacheProvider(CacheProvider cacheProvider, ServletContext servletContext)
-
Field Details
-
CACHE_PROVIDER_PARAM_NAME
- See Also:
-
-
Method Details
-
getCache
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
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
-
setCacheProvider
-
getCacheProvider
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
-
getDefaultCacheProvider
Returns an instance of the default cache provider. This is the provider that is used ingetCache(FacesContext, String)andgetCacheProvider(FacesContext)if no explicit provider has been set.- Returns:
- the default cache provider
-