java.lang.Object | +--java.util.Dictionary | +--java.util.Hashtable | +--com.ibm.commerce.registry.LRUDynamicHashtable
This is the LRUDynamicHashtable class which implements the Least Recently Used (LRU) algorithm to achieve the dynamic caching.
Field Summary | |
---|---|
static java.lang.String |
COPYRIGHT IBM copyright notice field. |
Constructor Summary | |
---|---|
LRUDynamicHashtable() LRUDynamicHashtable constructor. | |
LRUDynamicHashtable(int initialCapacity) LRUDynamicHashtable constructor. | |
LRUDynamicHashtable(int initialCapacity, float loadFactor) LRUDynamicHashtable constructor. |
Method Summary | |
---|---|
java.util.Enumeration |
elements() Returns an enumeration of the values in this hashtable. |
java.lang.Object |
get(java.lang.Object key) Returns the value to which the specified key is mapped in this hashtable. |
int |
getCacheSize() Returns the total number of cache entries. |
long |
getEvictions() Returns the number of entries that have been removed from the cache by LRU algorithm. |
long |
getHits() Returns the number of cache hits. |
long |
getMisses() Returns the number of cache misses. |
int |
getUsedCacheSize() Returns the number of currently contained cache entries. |
java.lang.Object |
put(java.lang.Object key, java.lang.Object value) Maps the specified key to the specified value in this hashtable. |
java.lang.Object |
remove(java.lang.Object key) Removes the key and its corresponding value from this hashtable. |
void |
removeAll() Removes all keys from the hashtable. |
void |
setCacheSize(int size) Specifies the cache size. |
void |
setInitialCapacity(int initialCapacity) Initialize the capacity of the registry. |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, entrySet, equals,
hashCode, isEmpty, keys, keySet, putAll, rehash, size, toString,
values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait,
wait |
Field Detail |
---|
public static final java.lang.String COPYRIGHT
Constructor Detail |
---|
public LRUDynamicHashtable()
public LRUDynamicHashtable(int initialCapacity)
public LRUDynamicHashtable(int initialCapacity, float loadFactor)
Method Detail |
---|
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
get
in class java.util.Hashtable
key
- The key used to look up in hashtable.public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
put
in class java.util.Hashtable
key
- The cache keyvalue
- The element associated with the key.public void setCacheSize(int size)
size
- intpublic void removeAll()
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
remove
in class
java.util.Hashtable
key
- The key in hashtable.public java.util.Enumeration elements()
elements
in class
java.util.Hashtable
public long getMisses()
getMisses
in interface
ManagedDynamicCache
public long getEvictions()
getEvictions
in interface
ManagedDynamicCache
public long getHits()
getHits
in interface
ManagedDynamicCache
public int getCacheSize()
getCacheSize
in interface
ManagedDynamicCache
public int getUsedCacheSize()
getUsedCacheSize
in interface
ManagedDynamicCache
public void setInitialCapacity(int initialCapacity)
setInitialCapacity
in interface
ManagedDynamicCache