|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.exolab.castor.persist.cache.AbstractBaseCache
org.exolab.castor.persist.cache.TimeLimited
public class TimeLimited
TimeLimited is a time limted least-recently-used Map.
Every object being put in the Map will live until the timeout expired.
Method dispose(Object) will be called whenever an
old object is diposed. Developer can get notify by overriding
the dispose method dispose(Object).
| Constructor Summary | |
|---|---|
TimeLimited()
Creates an instance of TimeLimited. |
|
| Method Summary | |
|---|---|
void |
clear()
Removes all mappings from this map. |
void |
close()
Life-cycle method to allow custom resource cleanup for a cache implementation |
boolean |
contains(java.lang.Object key)
Indicates whether the cache holds a value object for the specified key. |
boolean |
containsKey(java.lang.Object key)
Returns true if this map contains a mapping for the specified key |
boolean |
containsValue(java.lang.Object value)
Returns true if this map maps one or more keys to the specified value. |
protected void |
dispose(java.lang.Object o)
This method is called when an object is disposed. |
java.util.Enumeration |
elements()
Returns an enumeration of the values in this LRU map. |
java.util.Set |
entrySet()
Returns a set view of the keys contained in this map. |
void |
expire(java.lang.Object key)
Remove the object identified by key from the cache. |
java.lang.Object |
get(java.lang.Object key)
Returns the value to which the specified key is mapped in this Map. |
void |
initialize()
Lyfe-cycle method to allow custom initialization of cache implementations |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings. |
java.util.Set |
keySet()
Returns a collection view of the values contained in this map. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Maps the specified key to the specified
value in this Map. |
void |
putAll(java.util.Map aMap)
Copies all of the mappings from the specified map to this map (optional operation). |
java.lang.Object |
remove(java.lang.Object key)
Removes the key (and its corresponding value) from this Map. |
void |
setCapacity(int capacity)
Sets the cache capacity. |
int |
size()
Returns the number of key-value mappings in this map. |
java.util.Collection |
values()
|
| Methods inherited from class org.exolab.castor.persist.cache.AbstractBaseCache |
|---|
getCacheType, getCapacity, getClassName, invokeMethod, invokeMethodReturnBoolean, invokeMethodReturnInt, invokeMethodWithExceptions, invokeStaticMethodWithExceptions, setCacheType, setClassName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.exolab.castor.persist.cache.Cache |
|---|
getCacheType, getCapacity, getClassName, setCacheType, setClassName |
| Constructor Detail |
|---|
public TimeLimited()
| Method Detail |
|---|
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
key to the specified
value in this Map. Neither the key nor the
value can be null.
The value can be retrieved by calling the get method
with a key that is equal to the original key, before it is diposed
when the timeout of the entry is expired.
put in interface Cacheput in class AbstractBaseCachekey - the Map key.value - the value.
null if it did not have one.
java.lang.NullPointerException - if the key or value is
null.public java.lang.Object get(java.lang.Object key)
get in interface Cacheget in class AbstractBaseCachekey - - a key in the Map.
public void setCapacity(int capacity)
AbstractBaseCache
setCapacity in interface CachesetCapacity in class AbstractBaseCachecapacity - the cache capacity.Cache.getCapacity()public java.lang.Object remove(java.lang.Object key)
remove in interface Cacheremove in class AbstractBaseCachekey - the key that needs to be removed.
null if the key did not have a mapping.public java.util.Enumeration elements()
elements in interface Cacheelements in class AbstractBaseCacheEnumerationpublic void expire(java.lang.Object key)
expire in interface Cacheexpire in class AbstractBaseCachekey - the key that needs to be removed.public boolean contains(java.lang.Object key)
contains in interface Cachecontains in class AbstractBaseCachekey - - A key identifying a value object.
Cache.contains(java.lang.Object)protected void dispose(java.lang.Object o)
dispose in class AbstractBaseCacheo - - the disposed objectpublic int size()
Cache
size in interface Cachepublic void clear()
Cache
clear in interface Cachepublic boolean isEmpty()
Cache
isEmpty in interface Cachepublic boolean containsKey(java.lang.Object key)
Cache
containsKey in interface Cachekey - A key object.
public boolean containsValue(java.lang.Object value)
Cache
containsValue in interface Cachevalue - The object value.
public java.util.Collection values()
values in interface Cachepublic void putAll(java.util.Map aMap)
Cache
putAll in interface CacheaMap - The map to be copied.public java.util.Set entrySet()
Cache
entrySet in interface Cachepublic java.util.Set keySet()
Cache
keySet in interface Cachepublic void initialize()
Cache
initialize in interface CacheCache.initialize()public void close()
Cache
close in interface Cacheclose in class AbstractBaseCacheCache.close()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||