info.aduna.gee.publication.servlets.util
Class ExpiringCache
java.lang.Object
info.aduna.gee.publication.servlets.util.ExpiringCache
public class ExpiringCache
- extends Object
A cache of key-value pairs in which a "put" value is valid only for maximum time-to-live (ttl).
There is no "containsKey" method in order to avoid timing problems. Just "get" and check.
|
Nested Class Summary |
class |
ExpiringCache.TimedValue
To store the original "value" plus its "time" in a Hashtable we have to combine
these two. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_sequence
protected Vector _sequence
_timedValues
protected Hashtable _timedValues
_size
protected int _size
_ttl
protected int _ttl
ExpiringCache
public ExpiringCache(int size,
int ttl)
- Parameters:
size - The maximum amount of objects in the cache or infinit if less than or equal to 0.ttl - The maximum time to live of objects in the cache or infinit if less than or equal to 0.
put
public void put(Object key,
Object value)
get
public Object get(Object key)
remove
public void remove(Object key)
Copyright © 1997-2008 Aduna. All Rights Reserved.