org.apache.cocoon.pipeline.caching
Class SimpleCache

java.lang.Object
  extended by org.apache.cocoon.pipeline.caching.AbstractCache
      extended by org.apache.cocoon.pipeline.caching.SimpleCache
All Implemented Interfaces:
Cache

public class SimpleCache
extends AbstractCache

A very simple implementation of the Cache interface.

It uses a WeakHashMap as internal data store.


Constructor Summary
SimpleCache()
           
 
Method Summary
protected  void doClear()
          Actually clears the underlying storage.
protected  boolean doRemove(CacheKey cacheKey)
          Actually removes cached data from underlying storage.
protected  CacheValue retrieve(CacheKey cacheKey)
          Actually retrieves the CacheValue from the underlying storage.
protected  Set<CacheKey> retrieveKeySet()
          Actually retrieves the Set for CacheKey from underlying storage.
protected  void store(CacheKey cacheKey, CacheValue cacheValue)
          Actually stores the given cacheValue at the given cacheKey in the underlying storage.
 String toString()
          
 
Methods inherited from class org.apache.cocoon.pipeline.caching.AbstractCache
clear, get, get, isValid, keySet, put, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleCache

public SimpleCache()
Method Detail

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()

retrieve

protected CacheValue retrieve(CacheKey cacheKey)
Actually retrieves the CacheValue from the underlying storage.
This method must return the previously stored value - even if it is not valid anymore.

Specified by:
retrieve in class AbstractCache
Parameters:
cacheKey - The CacheKey to be used for retrieval.
Returns:
The previously stored CacheValue or null if no CacheValue is stored at the given cacheKey.
See Also:
AbstractCache.retrieve(org.apache.cocoon.pipeline.caching.CacheKey)

store

protected void store(CacheKey cacheKey,
                     CacheValue cacheValue)
Actually stores the given cacheValue at the given cacheKey in the underlying storage.

This method is to replace any previously stored CacheValue (if any).

Specified by:
store in class AbstractCache
Parameters:
cacheKey - The CacheKey to be used for storing.
cacheValue - The CacheValue to be stored.
See Also:
AbstractCache.store(org.apache.cocoon.pipeline.caching.CacheKey, org.apache.cocoon.pipeline.caching.CacheValue)

doClear

protected void doClear()
Actually clears the underlying storage.

Specified by:
doClear in class AbstractCache
See Also:
org.apache.cocoon.pipeline.caching.AbstractCach#doClear()

doRemove

protected boolean doRemove(CacheKey cacheKey)
Actually removes cached data from underlying storage.

Specified by:
doRemove in class AbstractCache
Parameters:
cacheKey - The CacheKey to be removed.
See Also:
org.apache.cocoon.pipeline.caching.AbstractCach#doRemove(org.apache.cocoon.pipeline.caching.CacheKey)

retrieveKeySet

protected Set<CacheKey> retrieveKeySet()
Actually retrieves the Set for CacheKey from underlying storage.

Specified by:
retrieveKeySet in class AbstractCache
Returns:
The Set of CacheKey of containded data.
See Also:
org.apache.cocoon.pipeline.caching.AbstractCach#retrieve()


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.