| java.lang.Object org.apache.oro.util.GenericCache
All known Subclasses: org.apache.oro.util.CacheRandom, org.apache.oro.util.CacheFIFO2, org.apache.oro.util.CacheLRU, org.apache.oro.util.CacheFIFO,
GenericCache | abstract public class GenericCache implements Cache,java.io.Serializable(Code) | | 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.
version: @version@ since: 1.0 See Also: Cache See Also: CacheLRU See Also: CacheFIFO See Also: CacheFIFO2 See Also: CacheRandom |
Constructor Summary | |
| GenericCache(int capacity) The primary constructor for GenericCache. |
DEFAULT_CAPACITY | final public static int DEFAULT_CAPACITY(Code) | | The default capacity to be used by the GenericCache subclasses
provided with this package. Its value is 20.
|
_numEntries | int _numEntries(Code) | | |
GenericCache | GenericCache(int capacity)(Code) | | The primary constructor for GenericCache. It has default
access so it will only be used within the package. It initializes
_table to a Hashtable of capacity equal to the capacity argument,
_cache to an array of size equal to the capacity argument, and
_numEntries to 0.
Parameters: capacity - The maximum capacity of the cache. |
capacity | final public int capacity()(Code) | | Returns the maximum number of elements that can be cached at one time.
The maximum number of elements that can be cached at one time. |
isFull | final public boolean isFull()(Code) | | |
size | final public int size()(Code) | | Returns the number of elements in the cache, not to be confused with
the
GenericCache.capacity() which returns the number
of elements that can be held in the cache at one time.
The current size of the cache (i.e., the number of elementscurrently cached). |
|
|