public abstract class CacheInstancePerScopeProvider extends Object implements CacheProvider
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.
Modifier and Type | Field and Description |
---|---|
static String |
APP_MAX_CAP_PARAM_NAME |
static String |
APP_TTL_PARAM_NAME |
static String |
DEFAULT_CACHE_PARAM_NAME |
static String |
SESSION_MAX_CAP_PARAM_NAME |
static String |
SESSION_TTL_PARAM_NAME |
Constructor and Description |
---|
CacheInstancePerScopeProvider() |
Modifier and Type | Method and Description |
---|---|
protected abstract Cache |
createCache(Integer timeToLive,
Integer maxCapacity) |
Cache |
getCache(FacesContext context,
String scope)
Gets an instance of a Cache using the configured cache provider.
|
Map<String,String> |
getParameters() |
void |
setParameters(Map<String,String> parameters)
Passes parameters to the cache provider implementation.
|
public static final String DEFAULT_CACHE_PARAM_NAME
public static final String APP_TTL_PARAM_NAME
public static final String SESSION_TTL_PARAM_NAME
public static final String APP_MAX_CAP_PARAM_NAME
public static final String SESSION_MAX_CAP_PARAM_NAME
public Cache getCache(FacesContext context, String scope)
CacheProvider
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.public void setParameters(Map<String,String> parameters)
CacheProvider
setParameters
in interface CacheProvider
parameters
- map of parameters used to configure the cache.Copyright © 2012–2016 OmniFaces. All rights reserved.