org.griphyn.vdl.router
Class Cache

java.lang.Object
  extended by org.griphyn.vdl.router.Cache

public class Cache
extends Object

Version:
$Revision: 50 $
Author:
Jens-S. V??ckler, Yong Zhao

Nested Class Summary
 class Cache.CacheEntry
          Interior class to encapsulate cached objects and their additional management keys.
 
Field Summary
(package private)  Map m_cache
          remember the objects to cache for.
(package private) static long[] m_stats
          Maintains statistics.
(package private)  long m_ttl
          remember how long to save a cache entry.
 
Constructor Summary
Cache(int ttl)
          ctor: Initialize the base functionalities of the cache.
 
Method Summary
 Object get(Object key)
          Requests an item from the cache.
 long[] getStatistics()
          Requests a copy of the statistics counters.
 Object set(Object key, Object value)
          Enters a value into the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_ttl

long m_ttl
remember how long to save a cache entry.


m_cache

Map m_cache
remember the objects to cache for. The cache consists of a concise key to locate any object, a value for the located large object, and a lifetime for the object.


m_stats

static long[] m_stats
Maintains statistics.

Constructor Detail

Cache

public Cache(int ttl)
ctor: Initialize the base functionalities of the cache.

Parameters:
ttl - is the lifetime of a positive entry in seconds.
Method Detail

set

public Object set(Object key,
                  Object value)
Enters a value into the cache.

Parameters:
key - is a concise, unique description of the object.
value - is the object to be cached.
Returns:
null for a fresh object, or the old CacheEntry.

get

public Object get(Object key)
Requests an item from the cache.

Parameters:
key - is the descriptor of the object.

getStatistics

public long[] getStatistics()
Requests a copy of the statistics counters.

Returns:
the counter values.


Copyright © 2007 The University of Southern California. All Rights Reserved.