|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.pipeline.caching.AbstractCache
public abstract class AbstractCache
An abstract implementation of the Cache
interface.
It handles the validity check for retrieving CacheValue
s 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 . |
CacheValue |
get(CacheKey cacheKey,
boolean includeInvalid)
Retrieves the CacheValue previously stored using the given cacheKey . |
protected boolean |
isValid(CacheKey cacheKey,
CacheValue cacheValue)
Determines if the given cacheValue is valid according to the given cacheKey . |
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 . |
boolean |
remove(CacheKey cacheKey)
Removes that CacheKey from this Cache. |
protected abstract CacheValue |
retrieve(CacheKey cacheKey)
Actually retrieves the CacheValue from the underlying storage. |
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. |
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 Cache
cacheKey
- 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 Cache
cacheKey
- 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.CacheKey
s represent the same data is ultimately depending on the implementation, but usually relies on the
equals
an/or hashcode
methods.
put
in interface Cache
cacheKey
- 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 Cache
Cache.clear()
public boolean remove(CacheKey cacheKey)
remove
in interface Cache
Cache.remove(org.apache.cocoon.pipeline.caching.CacheKey)
public Set<CacheKey> keySet()
Set
of CacheKey
contained in this Cache
keySet
in interface Cache
Cache.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 |