|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdsto.dfc.collections.cache.AbstractCache
public abstract class AbstractCache
This is the base class for all cache implementations provided in the
org.apache.oro.util package. To derive a subclass from GenericCache only the
... methods need be overridden. Although 4 subclasses of GenericCache are
provided with this package, users may not derive subclasses from this class.
Rather, users should create their own implmentations of the Cache
interface.
Cache
,
CacheLRU
,
Serialized FormField Summary | |
---|---|
protected CacheEntry[] |
cache
|
static int |
DEFAULT_CAPACITY
The default capacity to be used by the GenericCache subclasses provided with this package. |
protected int |
numEntries
|
protected HashMap |
table
|
Constructor Summary | |
---|---|
protected |
AbstractCache(int capacity)
The primary constructor for GenericCache. |
Method Summary | |
---|---|
int |
capacity()
Returns the maximum number of elements that can be cached at one time. |
Object |
get(Object key)
|
boolean |
isFull()
|
Iterator |
keys()
|
abstract Object |
put(Object key,
Object value)
Put an object into the cache. |
int |
size()
Returns the number of elements in the cache, not to be confused with the capacity() which returns the number of elements that can be held
in the cache at one time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_CAPACITY
protected int numEntries
protected CacheEntry[] cache
protected HashMap table
Constructor Detail |
---|
protected AbstractCache(int capacity)
capacity
- The maximum capacity of the cache.Method Detail |
---|
public abstract Object put(Object key, Object value)
Cache
put
in interface Cache
key
- The key.value
- The value to cache.
public Object get(Object key)
get
in interface Cache
public Iterator keys()
public int size()
capacity()
which returns the number of elements that can be held
in the cache at one time.
size
in interface Cache
public int capacity()
capacity
in interface Cache
public boolean isFull()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |