|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dasein.util.Cache<T>
T - the type of object being stored in the cachepublic class Cache<T>
Provides a cache of objects that will expire its contents as those
contents fail to be used. This cache uses
SoftReference to guarantee
that cached items will be removed when they have not been
referenced for a long time.
This class is not synchronized and therefore should be synchronized by the application for multi-threaded use.
Last modified $Date: 2005/08/15 16:19:34 $
| Constructor Summary | |
|---|---|
Cache()
|
|
| Method Summary | ||
|---|---|---|
boolean |
add(T ob)
Unsupported. |
|
boolean |
addAll(Collection<? extends T> coll)
Unsupported. |
|
void |
cache(Object key,
T val)
Caches the specified object identified by the specified key. |
|
void |
clear()
Clears the entire cache. |
|
boolean |
contains(Object ob)
Checks the specified object against the cache and verifies that it is in the cache. |
|
boolean |
containsAll(Collection<?> coll)
Checks the passed in collection and determines if all elements of that collection are contained within this cache. |
|
boolean |
containsKey(Object key)
Checks if an object with the specified key is in the cache. |
|
T |
get(Object key)
Provides the cached object identified by the specified key. |
|
boolean |
isEmpty()
|
|
Iterator<T> |
iterator()
Provides all of the valid objects in the cache. |
|
void |
release(Object key)
Releases the specified object from the cache. |
|
boolean |
remove(Object ob)
Unsupported. |
|
boolean |
removeAll(Collection<?> coll)
Unsupported. |
|
boolean |
retainAll(Collection<?> coll)
Unsupported. |
|
int |
size()
|
|
Object[] |
toArray()
|
|
|
toArray(E[] arr)
|
|
String |
toString()
Displays the current contents of the cache. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public Cache()
| Method Detail |
|---|
public boolean add(T ob)
add in interface Collection<T>ob - ignored
UnsupportedOperationException - alwayspublic boolean addAll(Collection<? extends T> coll)
addAll in interface Collection<T>coll - ignored
UnsupportedOperationException - always\
public void cache(Object key,
T val)
key - a unique key for this objectval - the object to be cachedpublic void clear()
clear in interface Collection<T>public boolean contains(Object ob)
contains in interface Collection<T>ob - the object to check for in the cache
public boolean containsAll(Collection<?> coll)
containsAll in interface Collection<T>coll - the collection to test
public boolean containsKey(Object key)
key - the object's identifier
public T get(Object key)
key - the unique identifier of the desired object
public boolean isEmpty()
isEmpty in interface Collection<T>public Iterator<T> iterator()
iterator in interface Iterable<T>iterator in interface Collection<T>public void release(Object key)
key - the unique identified for the item to releasepublic boolean remove(Object ob)
remove in interface Collection<T>ob - ignored
UnsupportedOperationException - alwayspublic boolean removeAll(Collection<?> coll)
removeAll in interface Collection<T>coll - ignored
UnsupportedOperationException - alwayspublic boolean retainAll(Collection<?> coll)
retainAll in interface Collection<T>coll - ignored
UnsupportedOperationException - alwayspublic int size()
size in interface Collection<T>public Object[] toArray()
toArray in interface Collection<T>public <E> E[] toArray(E[] arr)
toArray in interface Collection<T>public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||