org.pf.tools.cda.base.model.workset
Class StructuredCache

java.lang.Object
  extended by org.pf.tools.cda.base.model.workset.StructuredCache

public class StructuredCache
extends java.lang.Object

This cache can be used to store various objects in different categories. When the cache is cleared, all cached objects that implement the IReleasable interface are released.

Version:
1.0
Author:
Manfred Duchrow

Constructor Summary
StructuredCache()
          Initialize the new instance with default values.
 
Method Summary
 void clear()
          Clears the whole cache (all sections).
 void clearSection(java.lang.String section)
          Removes all cached objects from the specified section.
 java.lang.Object find(java.lang.String section, java.lang.Object key)
          Tries to find a cached object that was stored under the given key in the specified cache section.
 java.lang.Object remove(java.lang.String section, java.lang.Object key)
          Tries to remove a cached object that was stored under the given key in the specified cache section.
 void store(java.lang.String section, java.lang.Object key, java.lang.Object value)
          Stores in the specified section of the cache the given key/value pair
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructuredCache

public StructuredCache()
Initialize the new instance with default values.

Method Detail

store

public void store(java.lang.String section,
                  java.lang.Object key,
                  java.lang.Object value)
Stores in the specified section of the cache the given key/value pair

Parameters:
section - The name of the section
key - The key under which the value can be found
value - The value to cache

find

public java.lang.Object find(java.lang.String section,
                             java.lang.Object key)
Tries to find a cached object that was stored under the given key in the specified cache section.

Parameters:
section - The name of the section
key - The key under which the value can be found
Returns:
The desired object or null if not found

remove

public java.lang.Object remove(java.lang.String section,
                               java.lang.Object key)
Tries to remove a cached object that was stored under the given key in the specified cache section.

Parameters:
section - The name of the section
key - The key under which the value can be found
Returns:
The removed object or null if not found

clear

public void clear()
Clears the whole cache (all sections). All cached objects that are implementors of IReleasable will be released.


clearSection

public void clearSection(java.lang.String section)
Removes all cached objects from the specified section. Each cached object (value) that implements the IReleasable interface will be released.

Parameters:
section - The name of the cache section to clear