|
||||||||
| 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.
| 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 |
boolean |
contains(java.lang.Object value)
Checks if an element exists in the table, searching by value. |
boolean |
containsKey(java.lang.Object key)
Checks if an element exists in the table, searching by key. |
java.util.Enumeration |
elements()
Returns an Enumeration on the table's element values. |
java.lang.Object |
get(java.lang.Object key)
Retrieve an element from the table. |
int |
getCount(java.lang.Object key)
Retrieve the getcount of the key object |
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()
|
java.util.Enumeration |
getOrderedElements(int maxnumber)
|
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. |
boolean |
isEmpty()
Returns true if no elements are in the table. |
java.util.Enumeration |
keys()
Returns an Enumeration on the table's element keys. |
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. |
| Methods inherited from class java.util.Hashtable |
containsValue, entrySet, equals, hashCode, keySet, putAll, rehash, values |
| 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.Hashtablenull if it could not be foundpublic int getCount(java.lang.Object key)
public java.lang.Object get(java.lang.Object key)
get in class java.util.Hashtablenull if it could not be foundpublic java.lang.Object remove(java.lang.Object key)
remove in class java.util.Hashtablenull if it could not be foundpublic int size()
size in class java.util.Hashtablepublic void setSize(int size)
public 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 boolean containsKey(java.lang.Object key)
containsKey in class java.util.Hashtablepublic boolean contains(java.lang.Object value)
contains 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 boolean isEmpty()
true if no elements are in the table.isEmpty in class java.util.Hashtablepublic java.util.Enumeration keys()
Enumeration on the table's element keys.keys 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)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||