public class ModelObjectCache extends Object implements ContentCache<ModelObject>
The delay between checks against the underlying store is configurable.
| Modifier and Type | Class and Description |
|---|---|
static class |
ModelObjectCache.ModelObjectSentinel
Singleton sentinel class used to represent a 'null' value in some cache implementations
|
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,CacheItem<ModelObject>> |
cache |
protected long |
delay |
protected int |
maxSize |
protected org.springframework.extensions.webscripts.Store |
store |
| Constructor and Description |
|---|
ModelObjectCache(org.springframework.extensions.webscripts.Store store,
int maxSize,
long delay)
Instantiates a new model object cache.
|
ModelObjectCache(org.springframework.extensions.webscripts.Store store,
long delay)
Instantiates a new model object cache.
|
| Modifier and Type | Method and Description |
|---|---|
ModelObject |
get(String key)
Gets content stored in the cache
|
void |
invalidate()
Invalidates the cache
|
Set<String> |
keys()
Returns keys for the items in the cache
|
void |
put(String key,
ModelObject obj)
Places content into the cache (with default timeout)
|
void |
put(String key,
ModelObject obj,
long timeout)
Places content into the cache
|
void |
remove(String key)
Removes a content object from the cache.
|
Collection<CacheItem<ModelObject>> |
values()
Returns the values for the items in the cache
|
protected final org.springframework.extensions.webscripts.Store store
protected final long delay
protected final int maxSize
protected final Map<String,CacheItem<ModelObject>> cache
public ModelObjectCache(org.springframework.extensions.webscripts.Store store,
long delay)
store - the storedelay - the delay to check modified dates for items in the cachepublic ModelObjectCache(org.springframework.extensions.webscripts.Store store,
int maxSize,
long delay)
store - the storemaxSize - the maxSizedelay - the delay to check modified dates for items in the cachepublic ModelObject get(String key)
ContentCacheget in interface ContentCache<ModelObject>key - the keypublic void invalidate()
ContentCacheinvalidate in interface ContentCache<ModelObject>public void put(String key, ModelObject obj)
ContentCacheput in interface ContentCache<ModelObject>key - the keyobj - the objpublic void put(String key, ModelObject obj, long timeout)
ContentCacheput in interface ContentCache<ModelObject>key - the keyobj - the objtimeout - the timeout in millisecondspublic void remove(String key)
ContentCacheremove in interface ContentCache<ModelObject>key - the keypublic Collection<CacheItem<ModelObject>> values()
Copyright © 2005–2016 Alfresco Software. All rights reserved.