Node Director
Classes | Public Member Functions | List of all members
sfi.director.util.Cache Class Reference

implements a cache for arbitrary objects. More...

Classes

class  CacheObject

Public Member Functions

 Cache ()
 Cache (long ttl)
 Cache (long ttl, long extension)
 Cache (long ttl, long extension, long gcInterval)
void add (Object key, Object contents)
void add (Object key, Object contents, long ttl)
void add (Object key, Object contents, long ttl, long extension)
void gc ()
Object get (Object key)
void remove (Object key)
int size ()
Enumeration elements ()

Detailed Description

implements a cache for arbitrary objects.

Each object is associated with a maximum time to live (TTL) after which it is removed from the cache and a time "extension" (each time the object is accessed the minimal time it stays in the cache is extended by the extension period). So the minimum time an object stays in the cache is the "extension" period, the maximum time is the TTL. Every now and then a "garbage collector" wipes "dead" objects out of the cache - independently of if they are still stored or not "dead" objects will never be accessible and be treated like being already wiped out.

Constructor & Destructor Documentation

sfi.director.util.Cache.Cache ( )
sfi.director.util.Cache.Cache ( long  ttl)
sfi.director.util.Cache.Cache ( long  ttl,
long  extension 
)
sfi.director.util.Cache.Cache ( long  ttl,
long  extension,
long  gcInterval 
)

Member Function Documentation

void sfi.director.util.Cache.add ( Object  key,
Object  contents 
)
void sfi.director.util.Cache.add ( Object  key,
Object  contents,
long  ttl 
)
void sfi.director.util.Cache.add ( Object  key,
Object  contents,
long  ttl,
long  extension 
)
Enumeration sfi.director.util.Cache.elements ( )
void sfi.director.util.Cache.gc ( )
Object sfi.director.util.Cache.get ( Object  key)
void sfi.director.util.Cache.remove ( Object  key)
int sfi.director.util.Cache.size ( )

The documentation for this class was generated from the following file: