org.castor.cache.simple
Class TimeLimited

java.lang.Object
  extended by org.castor.cache.AbstractBaseCache
      extended by org.castor.cache.simple.TimeLimited
All Implemented Interfaces:
Map<Object,Object>, Cache

public class TimeLimited
extends AbstractBaseCache

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
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static int DEFAULT_TTL
          Default ttl of cache.
static String PARAM_TTL
          Mapped initialization parameter ttl.
static String TYPE
          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
TimeLimited()
           
 
Method Summary
 void clear()
          
 boolean containsKey(Object key)
          
 boolean containsValue(Object value)
          
 Set<Map.Entry<Object,Object>> entrySet()
          
 Object get(Object key)
          
 int getTTL()
          Get real ttl of this cache.
 String getType()
          Indicates the type of this cache.
 void initialize(Properties params)
          Lyfe-cycle method to allow custom initialization of cache implementations.
 boolean isEmpty()
          
 Set<Object> keySet()
          
 Object put(Object key, Object value)
          
 void putAll(Map<? extends Object,? extends Object> map)
          
 Object remove(Object key)
          
 int size()
          
 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
equals, hashCode
 

Field Detail

TYPE

public static final String TYPE
The type of the cache.

See Also:
Constant Field Values

PARAM_TTL

public static final String PARAM_TTL
Mapped initialization parameter ttl.

See Also:
Constant Field Values

DEFAULT_TTL

public static final int DEFAULT_TTL
Default ttl of cache.

See Also:
Constant Field Values
Constructor Detail

TimeLimited

public TimeLimited()
Method Detail

initialize

public final void initialize(Properties params)
                      throws CacheAcquireException
Lyfe-cycle method to allow custom initialization of cache implementations.

Specified by:
initialize in interface Cache
Overrides:
initialize in class AbstractBaseCache
Parameters:
params - Parameters to initialize the cache (e.g. name, capacity).
Throws:
CacheAcquireException - If cache can not be initialized.

getType

public final String 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

public final boolean containsKey(Object key)


containsValue

public final boolean containsValue(Object value)


get

public final Object get(Object key)


put

public final Object put(Object key,
                        Object value)


remove

public Object remove(Object key)


putAll

public final void putAll(Map<? extends Object,? extends Object> map)


clear

public final void clear()


keySet

public final Set<Object> keySet()


values

public final Collection<Object> values()


entrySet

public final Set<Map.Entry<Object,Object>> entrySet()



Copyright © 2010. All Rights Reserved.