Package org.castor.cache.simple
Class CountLimited
java.lang.Object
org.castor.cache.AbstractBaseCache
org.castor.cache.simple.CountLimited
CountLimited is a count limted least-recently-used Map. Every object being
put in the Map will live until the map is full. If the map is full, the least recently
used object will be disposed.
The capacity is passed to the cache at initialization by the individual cache property capacity which defines the maximum number of objects the cache can hold. If not specified a default capacity of 30 objects will be used.
- Version:
- $Revision: 8102 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
- Author:
- Thomas Yip, Werner Guttmann, Ralf Joachim
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault capacity of cache.static final StringMapped initialization parametercapacity.static final StringThe type of the cache.Fields inherited from interface org.castor.cache.Cache
DEFAULT_DEBUG, DEFAULT_NAME, DEFAULT_TYPE, PARAM_DEBUG, PARAM_NAME, PARAM_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()intGet real capacity of this cache.getType()Indicates the type of this cache.voidinitialize(Properties params) Lyfe-cycle method to allow custom initialization of cache implementations.booleanisEmpty()keySet()voidintsize()values()Methods inherited from class org.castor.cache.AbstractBaseCache
close, expire, expireAll, getName, invokeMethod, invokeStaticMethodMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
TYPE
The type of the cache.- See Also:
-
PARAM_CAPACITY
Mapped initialization parametercapacity.- See Also:
-
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITYDefault capacity of cache.- See Also:
-
-
Constructor Details
-
CountLimited
public CountLimited()
-
-
Method Details
-
initialize
Lyfe-cycle method to allow custom initialization of cache implementations.- Specified by:
initializein interfaceCache- Overrides:
initializein classAbstractBaseCache- Parameters:
params- Parameters to initialize the cache (e.g. name, capacity).- Throws:
CacheAcquireException- If cache can not be initialized.
-
getType
Indicates the type of this cache.- Returns:
- The cache type.
-
getCapacity
public int getCapacity()Get real capacity of this cache.- Returns:
- Real capacity of this cache.
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
-
containsValue
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-