java.lang.Object
org.omnifaces.util.cache.CacheInstancePerScopeProvider
- All Implemented Interfaces:
CacheProvider
- Direct Known Subclasses:
DefaultCacheProvider
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.
- Since:
- 1.1
- Author:
- Arjan Tijms
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract CachecreateCache(Integer timeToLive, Integer maxCapacity) getCache(FacesContext context, String scope) Gets an instance of a Cache using the configured cache provider.voidsetParameters(Map<String, String> parameters) Passes parameters to the cache provider implementation.
-
Field Details
-
DEFAULT_CACHE_PARAM_NAME
- See Also:
-
APP_TTL_PARAM_NAME
- See Also:
-
SESSION_TTL_PARAM_NAME
- See Also:
-
APP_MAX_CAP_PARAM_NAME
- See Also:
-
SESSION_MAX_CAP_PARAM_NAME
- See Also:
-
-
Constructor Details
-
CacheInstancePerScopeProvider
public CacheInstancePerScopeProvider()
-
-
Method Details
-
getCache
Description copied from interface:CacheProviderGets an instance of a Cache using the configured cache provider.- Specified by:
getCachein interfaceCacheProvider- Parameters:
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.- Returns:
- Cache instance encapsulating the cache represented by this CacheProvider
-
setParameters
Description copied from interface:CacheProviderPasses 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:
setParametersin interfaceCacheProvider- Parameters:
parameters- map of parameters used to configure the cache.
-
getParameters
-
createCache
-