net.spy.util
Class TimeStampedHash

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended bynet.spy.util.TimeStampedHash
All Implemented Interfaces:
Cloneable, Map, Serializable

public class TimeStampedHash
extends Hashtable

A Hashtable that remembers when it was accessed. Good for caching and stuff like that.

See Also:
Serialized Form

Constructor Summary
TimeStampedHash()
          Get an instance of SpyCacheStore.
 
Method Summary
 Object get(Object key)
           
 long getGetAge()
          How many milliseconds ago was the last get operation?
 long getHits()
          Get the number of hits (number of requests for items that were actually there).
 long getLastGet()
          Find out the last time this thing last had a Get.
 long getLastPut()
          Find out the last time this thing last had a Put.
 long getMisses()
          Get the number of misses (number of requests for items that were not actually there).
 long getNumPuts()
          Get the total number of put() invocations.
 long getPutAge()
          How many milliseconds ago was the last put operation?
 long getTimestamp()
          Find out the last time this thing was used (put or get was called).
 long getUseAge()
          How many milliseconds ago was the last put or get operation?
 long getWatermark()
          Get the watermark (maximum number of objects seen at any one time).
 Object put(Object key, Object value)
           
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, hashCode, isEmpty, keys, keySet, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeStampedHash

public TimeStampedHash()
Get an instance of SpyCacheStore.

Method Detail

get

public Object get(Object key)
See Also:
Hashtable

put

public Object put(Object key,
                  Object value)
See Also:
Hashtable

getTimestamp

public long getTimestamp()
Find out the last time this thing was used (put or get was called).


getLastGet

public long getLastGet()
Find out the last time this thing last had a Get.


getLastPut

public long getLastPut()
Find out the last time this thing last had a Put.


getPutAge

public long getPutAge()
How many milliseconds ago was the last put operation?


getGetAge

public long getGetAge()
How many milliseconds ago was the last get operation?


getUseAge

public long getUseAge()
How many milliseconds ago was the last put or get operation?


getHits

public long getHits()
Get the number of hits (number of requests for items that were actually there).


getMisses

public long getMisses()
Get the number of misses (number of requests for items that were not actually there).


getWatermark

public long getWatermark()
Get the watermark (maximum number of objects seen at any one time).


getNumPuts

public long getNumPuts()
Get the total number of put() invocations.