org.omnifaces.component.output.cache
Class CacheInstancePerScopeProvider
java.lang.Object
org.omnifaces.component.output.cache.CacheInstancePerScopeProvider
- All Implemented Interfaces:
- CacheProvider
- Direct Known Subclasses:
- DefaultCacheProvider
public abstract class CacheInstancePerScopeProvider
- extends java.lang.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.
- Since:
- 1.1
- Author:
- Arjan Tijms
Method Summary |
protected abstract Cache |
createCache(java.lang.Integer timeToLive,
java.lang.Integer maxCapacity)
|
Cache |
getCache(javax.faces.context.FacesContext context,
java.lang.String scope)
Gets an instance of a Cache using the configured cache provider. |
java.util.Map<java.lang.String,java.lang.String> |
getParameters()
|
void |
setParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
Passes parameters to the cache provider implementation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_CACHE_PARAM_NAME
public static final java.lang.String DEFAULT_CACHE_PARAM_NAME
- See Also:
- Constant Field Values
APP_TTL_PARAM_NAME
public static final java.lang.String APP_TTL_PARAM_NAME
- See Also:
- Constant Field Values
SESSION_TTL_PARAM_NAME
public static final java.lang.String SESSION_TTL_PARAM_NAME
- See Also:
- Constant Field Values
APP_MAX_CAP_PARAM_NAME
public static final java.lang.String APP_MAX_CAP_PARAM_NAME
- See Also:
- Constant Field Values
SESSION_MAX_CAP_PARAM_NAME
public static final java.lang.String SESSION_MAX_CAP_PARAM_NAME
- See Also:
- Constant Field Values
CacheInstancePerScopeProvider
public CacheInstancePerScopeProvider()
getCache
public Cache getCache(javax.faces.context.FacesContext context,
java.lang.String scope)
- Description copied from interface:
CacheProvider
- Gets an instance of a Cache using the configured cache provider.
- Specified by:
getCache
in interface CacheProvider
- 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
public void setParameters(java.util.Map<java.lang.String,java.lang.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:
parameters
- map of parameters used to configure the cache.
getParameters
public java.util.Map<java.lang.String,java.lang.String> getParameters()
createCache
protected abstract Cache createCache(java.lang.Integer timeToLive,
java.lang.Integer maxCapacity)