|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.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| Nested Class Summary | |
class |
LRUHashtable.LRUEntry
Element used to store information from the LRUHashtable. |
protected class |
LRUHashtable.LRUEntrySet
Used by 'entrySet' implementation, to make the Map modifiable. |
protected class |
LRUHashtable.LRUEntrySetIterator
Used by 'entrySet' implementation, to make the Map modifiable. |
| 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()
Returns the entries of this Map. |
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, or using the iterator of entrySet() otherwise the linked list gets messed up. |
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 interface java.util.Mapkey - the key of the elementvalue - the value of the element
null if it could not be foundpublic int getCount(java.lang.Object key)
key - the key of the element
public java.lang.Object get(java.lang.Object key)
get in interface java.util.Mapkey - the key of the element
null if it could not be foundpublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mapkey - the key of the element
null if it could not be foundpublic java.util.Set keySet()
keySet in interface java.util.Mappublic java.util.Set entrySet()
entrySet in interface java.util.Mappublic java.util.Collection values()
values in interface java.util.MapkeySet()public int size()
size in interface java.util.Mappublic void setSize(int size)
size - the new desired sizepublic int getSize()
public java.lang.String toString()
public java.lang.String toString(boolean which)
which - if true, the stored values are described.
public void clear()
clear in interface java.util.Mappublic java.lang.Object clone()
public java.util.Enumeration elements()
Enumeration on the table's element values.
public 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: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||