public final class DefaultSimpleCache
extends java.lang.Object
implements org.alfresco.repo.cache.SimpleCache, org.springframework.beans.factory.BeanNameAware
SimpleCache implementation backed by a ConcurrentLinkedHashMap.| Constructor and Description |
|---|
DefaultSimpleCache()
Default constructor.
|
DefaultSimpleCache(int maxItems,
java.lang.String cacheName)
Construct a cache using the specified capacity and name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
contains(java.io.Serializable key) |
java.lang.Object |
get(java.io.Serializable key) |
java.lang.String |
getCacheName()
Retrieve the name of this cache.
|
java.util.Collection |
getKeys() |
int |
getMaxItems()
Gets the maximum number of items that the cache will hold.
|
void |
put(java.io.Serializable key,
java.lang.Object value) |
boolean |
putAndCheckUpdate(java.io.Serializable key,
java.lang.Object value)
put method that may be used to check for updates in a thread-safe manner. |
void |
remove(java.io.Serializable key) |
void |
setBeanName(java.lang.String cacheName)
Since there are many cache instances, it is useful to be able to associate
a name with each one.
|
void |
setCacheName(java.lang.String cacheName)
Since there are many cache instances, it is useful to be able to associate
a name with each one.
|
void |
setMaxItems(int maxItems)
Sets the maximum number of items that the cache will hold.
|
java.lang.String |
toString() |
public DefaultSimpleCache(int maxItems,
java.lang.String cacheName)
maxItems - The cache capacity.public DefaultSimpleCache()
DefaultSimpleCache.DEFAULT_CAPACITY
and no name.public boolean contains(java.io.Serializable key)
contains in interface org.alfresco.repo.cache.SimpleCachepublic java.util.Collection getKeys()
getKeys in interface org.alfresco.repo.cache.SimpleCachepublic java.lang.Object get(java.io.Serializable key)
get in interface org.alfresco.repo.cache.SimpleCachepublic void put(java.io.Serializable key,
java.lang.Object value)
put in interface org.alfresco.repo.cache.SimpleCachepublic boolean putAndCheckUpdate(java.io.Serializable key,
java.lang.Object value)
put method that may be used to check for updates in a thread-safe manner.true if the put resulted in a change in value, false otherwise.public void remove(java.io.Serializable key)
remove in interface org.alfresco.repo.cache.SimpleCachepublic void clear()
clear in interface org.alfresco.repo.cache.SimpleCachepublic java.lang.String toString()
toString in class java.lang.Objectpublic void setMaxItems(int maxItems)
maxItems - public int getMaxItems()
public java.lang.String getCacheName()
DefaultSimpleCache.setCacheName(String)public void setCacheName(java.lang.String cacheName)
cacheName - DefaultSimpleCache.setBeanName(String)public void setBeanName(java.lang.String cacheName)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarecacheName - Set automatically by Spring, but can be set manually if required.Copyright © 2005 - 2013 Alfresco Software, Inc. All Rights Reserved.