Package org.apache.oro.util
Class GenericCache
- java.lang.Object
-
- org.apache.oro.util.GenericCache
-
- All Implemented Interfaces:
java.io.Serializable
,Cache
- Direct Known Subclasses:
CacheFIFO
,CacheFIFO2
,CacheLRU
,CacheRandom
public abstract class GenericCache extends java.lang.Object implements Cache, java.io.Serializable
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 theCache
interface.- Since:
- 1.0
- Version:
- 2.0.8
- See Also:
Cache
,CacheLRU
,CacheFIFO
,CacheFIFO2
,CacheRandom
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CAPACITY
The default capacity to be used by the GenericCache subclasses provided with this package.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addElement(java.lang.Object key, java.lang.Object value)
int
capacity()
Returns the maximum number of elements that can be cached at one time.java.lang.Object
getElement(java.lang.Object key)
boolean
isFull()
java.util.Iterator
keys()
int
size()
Returns the number of elements in the cache, not to be confused with thecapacity()
which returns the number of elements that can be held in the cache at one time.
-
-
-
Field Detail
-
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITY
The default capacity to be used by the GenericCache subclasses provided with this package. Its value is 20.- See Also:
- Constant Field Values
-
-
Method Detail
-
addElement
public abstract void addElement(java.lang.Object key, java.lang.Object value)
- Specified by:
addElement
in interfaceCache
-
getElement
public java.lang.Object getElement(java.lang.Object key)
- Specified by:
getElement
in interfaceCache
-
keys
public final java.util.Iterator keys()
-
size
public final int size()
Returns the number of elements in the cache, not to be confused with thecapacity()
which returns the number of elements that can be held in the cache at one time.
-
capacity
public final int capacity()
Returns the maximum number of elements that can be cached at one time.
-
isFull
public final boolean isFull()
-
-