|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--org.mmbase.util.LRUHashtable
A hashtable which has a maximum of entries. Old entries are removed when the maximum is reached. This table is used mostly to implement a simple caching system.
Cache, Serialized Form| Inner Class Summary | |
static class |
LRUHashtable.LRUEntry
Element used to store information from the LRUHashtable. |
| Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
| Constructor Summary | |
LRUHashtable()
Creates the URL Hashtable with maximum capacity 100, starting capacity 101, and growing capacity 0.75. |
|
LRUHashtable(int size)
Creates the URL Hashtable with starting capacity 101 and growing capacity 0.75. |
|
LRUHashtable(int size,
int cap)
Creates the URL Hashtable with growing capacity 0.75. |
|
LRUHashtable(int size,
int cap,
float lf)
Creates the URL Hashtable. |
|
| Method Summary | |
void |
clear()
Clears the table. |
java.lang.Object |
clone()
NOT IMPLEMENTED |
java.util.Enumeration |
elements()
Returns an Enumeration on the table's element values. |
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
Retrieves an element from the table. |
int |
getCount(java.lang.Object key)
Retrieves the count of the object with a certain key. |
int |
getHits()
Returns the number of times an element was succesfully retrieved from the table. |
int |
getMisses()
Returns the number of times an element cpould not be retrieved from the table. |
java.util.Enumeration |
getOrderedElements()
Deprecated. use getOrderedEntries |
java.util.Enumeration |
getOrderedElements(int maxnumber)
Deprecated. use getOrderedEntries |
java.util.List |
getOrderedEntries()
Returns an ordered list of Map.Entry's. |
java.util.List |
getOrderedEntries(int maxNumber)
Returns an ordered list of Map.Entry's. |
int |
getPuts()
Returns the number of times an element was committed to the table. |
double |
getRatio()
Returns the ratio of hits and misses. |
int |
getSize()
Return the maximum size of the table |
java.lang.String |
getStats()
Returns statistics on this table. |
java.util.Set |
keySet()
You should only remove entries from LRUHashtable using the 'remove' function. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Store an element in the table. |
java.lang.Object |
remove(java.lang.Object key)
Remove an element from the table. |
void |
setSize(int size)
Change the maximum size of the table. |
int |
size()
Return the current size of the table |
java.lang.String |
toString()
Returns a description of the table. |
java.lang.String |
toString(boolean which)
Returns a description of the table. |
java.util.Collection |
values()
|
| Methods inherited from class java.util.Hashtable |
contains, containsKey, containsValue, equals, hashCode, isEmpty, keys, putAll, rehash |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public LRUHashtable(int size,
int cap,
float lf)
size - the maximum capacitycap - the starting capacity (used to improve performance)lf - the amount with which current capacity frows
public LRUHashtable(int size,
int cap)
size - the maximum capacitycap - the starting capacity (used to improve performance)public LRUHashtable(int size)
size - the maximum capacitypublic LRUHashtable()
| Method Detail |
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in class java.util.Hashtablekey - the key of the elementvalue - the value of the elementnull if it could not be foundpublic int getCount(java.lang.Object key)
key - the key of the elementpublic java.lang.Object get(java.lang.Object key)
get in class java.util.Hashtablekey - the key of the elementnull if it could not be foundpublic java.lang.Object remove(java.lang.Object key)
remove in class java.util.Hashtablekey - the key of the elementnull if it could not be foundpublic java.util.Set keySet()
keySet in class java.util.Hashtablepublic java.util.Set entrySet()
entrySet in class java.util.HashtablekeySet()public java.util.Collection values()
values in class java.util.HashtablekeySet()public int size()
size in class java.util.Hashtablepublic void setSize(int size)
size - the new desired sizepublic int getSize()
public java.lang.String toString()
toString in class java.util.Hashtablepublic java.lang.String toString(boolean which)
which - if true, the stored values are described.public void clear()
clear in class java.util.Hashtablepublic java.lang.Object clone()
clone in class java.util.Hashtablepublic java.util.Enumeration elements()
Enumeration on the table's element values.elements in class java.util.Hashtablepublic double getRatio()
public int getHits()
public int getMisses()
public int getPuts()
public java.lang.String getStats()
public java.util.Enumeration getOrderedElements()
public java.util.Enumeration getOrderedElements(int maxnumber)
public java.util.List getOrderedEntries()
public java.util.List getOrderedEntries(int maxNumber)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||