iiitToolkit 1.0

de.iiit.cache
Class GenericCache

java.lang.Object
  |
  +--de.iiit.cache.GenericCache
Direct Known Subclasses:
GenericInvalidationCache, GenericTimeoutCache

public class GenericCache
extends Object

Implements a very generic cache

Version:
$Revision: 1.8 $ $Date: 2003/03/12 13:20:09 $

Constructor Summary
GenericCache()
          Creates a new instance of GenericCache
 
Method Summary
 void addElement(Object key, Object value)
          Add a new element to the cache.
protected  void clear()
          Clears the cache
 Object getElement(Object key)
          Retrieves a cache-entry
 Enumeration getKeys()
          Get all defined keys
 void removeElement(Object key)
          Remove an entry from the cache
protected  int size()
          Retrieves the number of elements stored in the cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericCache

public GenericCache()
Creates a new instance of GenericCache

Method Detail

clear

protected void clear()
Clears the cache


size

protected int size()
Retrieves the number of elements stored in the cache

Returns:
the number of elements

addElement

public void addElement(Object key,
                       Object value)
Add a new element to the cache. If an element with the same key already exists it will be replaced.

Parameters:
key - The unique key of the cache entry
value - The value of the cache entry

getElement

public Object getElement(Object key)
                  throws CacheFaultException
Retrieves a cache-entry

Parameters:
key - The unique key of the cache entry to retrieve
Returns:
The cache entry with the given key
Throws:
CacheFaultException - if there is no entry with the given key

getKeys

public Enumeration getKeys()
Get all defined keys

Returns:
An enumeration of all defined keys

removeElement

public void removeElement(Object key)
Remove an entry from the cache

Parameters:
key - The unique key of the entry to remove

iiitToolkit 1.0

Copyright © 2002, 2003 ingeneurbuero fuer innovative informationstechnik, Dipl.-Ing. Joerg Beckmann, Dortmund, Germany. All Rights Reserved.
See Copyright statement