com.infoengine.object
Class ObjectCache

java.lang.Object
  extended bycom.infoengine.object.ObjectCache

public class ObjectCache
extends Object

Implementation of a single keyed generic cache of Java objects


Nested Class Summary
(package private)  class ObjectCache.CacheObject
          inner class used to store cached objects
 
Field Summary
private  Hashtable cache
           
private  long timeToLive
           
 
Constructor Summary
ObjectCache()
          create a new ObjectCache with items that do not expire
ObjectCache(long timeToLive)
          create a new ObjectCache with items that will expire after timeToLive milliseconds
 
Method Summary
 Object get(Object key)
          retrieve an object from the cache
 void put(Object key, Object object)
          insert an item into the cache, retrievable using key
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

private Hashtable cache

timeToLive

private long timeToLive
Constructor Detail

ObjectCache

public ObjectCache()
create a new ObjectCache with items that do not expire


ObjectCache

public ObjectCache(long timeToLive)
create a new ObjectCache with items that will expire after timeToLive milliseconds

Method Detail

put

public void put(Object key,
                Object object)
insert an item into the cache, retrievable using key

Throws:
java.lang.NullPointerException - if key is null

get

public Object get(Object key)
retrieve an object from the cache