Package org.castor.cache.simple
Class TimeLimited
java.lang.Object
org.castor.cache.AbstractBaseCache
org.castor.cache.simple.TimeLimited
TimeLimited is a time limted first-in-first-out Map. Every object
being put in the Map will live until the timeout expired.
The expiration time is passed to the cache at initialization by the individual cache property ttl which defines the timeout of every object in the cache in seconds. If not specified a timeout of 30 seconds will be used.
- Version:
- $Revision: 8102 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
- Author:
- Thomas Yip, Stein M. Hugubakken, Werner Guttmann, Ralf Joachim
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Default ttl of cache.static final String
Mapped initialization parameterttl
.static final String
The 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 TypeMethodDescriptionfinal void
clear()
final boolean
containsKey
(Object key) final boolean
containsValue
(Object value) entrySet()
final Object
final int
getTTL()
Get real ttl of this cache.final String
getType()
Indicates the type of this cache.final void
initialize
(Properties params) Lyfe-cycle method to allow custom initialization of cache implementations.final boolean
isEmpty()
keySet()
final Object
final void
final int
size()
final Collection
<Object> values()
Methods inherited from class org.castor.cache.AbstractBaseCache
close, expire, expireAll, getName, invokeMethod, invokeStaticMethod
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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_TTL
Mapped initialization parameterttl
.- See Also:
-
DEFAULT_TTL
public static final int DEFAULT_TTLDefault ttl of cache.- See Also:
-
-
Constructor Details
-
TimeLimited
public TimeLimited()
-
-
Method Details
-
initialize
Lyfe-cycle method to allow custom initialization of cache implementations.- Specified by:
initialize
in interfaceCache
- Overrides:
initialize
in 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.
-
getTTL
public final int getTTL()Get real ttl of this cache.- Returns:
- Real ttl of this cache.
-
size
public final int size() -
isEmpty
public final boolean isEmpty() -
containsKey
-
containsValue
-
get
-
put
-
remove
-
putAll
-
clear
public final void clear() -
keySet
-
values
-
entrySet
-