|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.cocoon.pipeline.caching.AbstractCache
public abstract class AbstractCache
An abstract implementation of the Cache interface.
It handles the validity check for retrieving CacheValues but relies on child classes for actually accessing the underlying
stores.
| Constructor Summary | |
|---|---|
AbstractCache()
|
|
| Method Summary | |
|---|---|
void |
clear()
Removes all data coneined in this Cache |
protected abstract void |
doClear()
Actually clears the underlying storage. |
protected abstract boolean |
doRemove(CacheKey cacheKey)
Actually removes cached data from underlying storage. |
CacheValue |
get(CacheKey cacheKey)
Retrieves the CacheValue previously stored using the given cacheKey.If the cacheKey is not stored in this Cache this method will return null.Furthermore the Cache will check if the stored CacheValue is still valid (using the
CacheValue.isValid(CacheKey) method). |
CacheValue |
get(CacheKey cacheKey,
boolean includeInvalid)
Retrieves the CacheValue previously stored using the given cacheKey.If the cacheKey is not stored in this Cache this method will return null.This method will omit the check for validity if includeInvalid is true (i.e. |
protected boolean |
isValid(CacheKey cacheKey,
CacheValue cacheValue)
Determines if the given cacheValue is valid according to the given cacheKey.This method returns true if and only if the given cacheValue is not null and calling
CacheValue.isValid(CacheKey) with the given cacheKey returns true. |
Set<CacheKey> |
keySet()
Returns Set of CacheKey contained in this Cache |
void |
put(CacheKey cacheKey,
CacheValue cacheValue)
Stores the given cacheValue at the given cacheKey.If this cache already contains the given cacheKey it will be replaced.If two CacheKeys represent the same data is ultimately depending on the implementation, but usually relies on the
equals an/or hashcode methods. |
boolean |
remove(CacheKey cacheKey)
Removes that CacheKey from this Cache. |
protected abstract 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. |
protected abstract Set<CacheKey> |
retrieveKeySet()
Actually retrieves the Set for CacheKey from underlying storage. |
protected abstract 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). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractCache()
| Method Detail |
|---|
public final CacheValue get(CacheKey cacheKey)
CacheValue previously stored using the given cacheKey.cacheKey is not stored in this Cache this method will return null.Cache will check if the stored CacheValue is still valid (using the
CacheValue.isValid(CacheKey) method). If the CacheValue is considered to be invalid this method will return
null as well (indicating that no valid CacheValue is available).Cache.get(CacheKey, boolean) method.
get in interface CachecacheKey - The CacheKey defining which CacheValue to retrieve.
CacheValue or null if no or no valid CacheValue is stored at the
given cacheValue.Cache.get(org.apache.cocoon.pipeline.caching.CacheKey)
public final CacheValue get(CacheKey cacheKey,
boolean includeInvalid)
CacheValue previously stored using the given cacheKey.cacheKey is not stored in this Cache this method will return null.includeInvalid is true (i.e. the returned CacheValue
might be invalid in this case).
get in interface CachecacheKey - The CacheKey defining which CacheValue to retrieve.includeInvalid - Defines whether invalid CacheValue should be returned or not. Using true will also
return invalid CacheValue. Using false will yield the same results as Cache.get(CacheKey).
CacheValue or null if and only if no CacheValue is stored at the
given cacheValue.Cache.get(org.apache.cocoon.pipeline.caching.CacheKey, boolean)
public final void put(CacheKey cacheKey,
CacheValue cacheValue)
cacheValue at the given cacheKey.cacheKey it will be replaced.CacheKeys represent the same data is ultimately depending on the implementation, but usually relies on the
equals an/or hashcode methods.
put in interface CachecacheKey - The CacheKey to be used for storing.cacheValue - The CacheValue to be stored.Cache.put(org.apache.cocoon.pipeline.caching.CacheKey,
org.apache.cocoon.pipeline.caching.CacheValue)public void clear()
clear in interface CacheCache.clear()public boolean remove(CacheKey cacheKey)
remove in interface CacheCache.remove(org.apache.cocoon.pipeline.caching.CacheKey)public Set<CacheKey> keySet()
Set of CacheKey contained in this Cache
keySet in interface CacheCache.keySet()
protected boolean isValid(CacheKey cacheKey,
CacheValue cacheValue)
cacheValue is valid according to the given cacheKey.true if and only if the given cacheValue is not null and calling
CacheValue.isValid(CacheKey) with the given cacheKey returns true.
cacheKey - The CacheKey to be used for checking the cacheValue's validity.cacheValue - The CacheValue to check for validity.
true if the given cacheValue is not null and valid for the given
cacheKey.protected abstract CacheValue retrieve(CacheKey cacheKey)
CacheValue from the underlying storage.
cacheKey - The CacheKey to be used for retrieval.
CacheValue or null if no CacheValue is stored at the given
cacheKey.
protected abstract void store(CacheKey cacheKey,
CacheValue cacheValue)
cacheValue at the given cacheKey in the underlying storage.CacheValue (if any).
cacheKey - The CacheKey to be used for storing.cacheValue - The CacheValue to be stored.protected abstract void doClear()
protected abstract boolean doRemove(CacheKey cacheKey)
cacheKey - The CacheKey to be removed.protected abstract Set<CacheKey> retrieveKeySet()
Set for CacheKey from underlying storage.
Set of CacheKey of containded data.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||