org.objectweb.cjdbc.controller.cache.result.rules
Class RelaxedCaching
java.lang.Object
org.objectweb.cjdbc.controller.cache.result.CacheBehavior
org.objectweb.cjdbc.controller.cache.result.rules.RelaxedCaching
- public class RelaxedCaching
- extends CacheBehavior
RelaxedCaching means we set a timeout value for this entry, and when expired
we keep in the cache if no write has modified the corresponding result, we
wait for the same amount of time again. RelaxedCaching may provide stale
data. The timeout defines the maximum staleness of a cache entry. It means
that the cache may return an entry that is out of date. timeout: is a value
in seconds and 0 means no timeout (always in the cache) keepIfNotDirty: if
true the entry is kept in the cache and the timeout is reset, if false, the
entry is removed from the cache after the timeout has expired even if the
entry was not affected by a write.
- Version:
- 1.0
- Author:
- Nicolas Modrzyk , Emmanuel Cecchet
Fields inherited from class org.objectweb.cjdbc.controller.cache.result.CacheBehavior |
|
Constructor Summary |
RelaxedCaching(boolean keepIfNotDirty,
long timeout)
Create new RelaxedCaching action |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
timeout
private long timeout
keepIfNotDirty
private boolean keepIfNotDirty
RelaxedCaching
public RelaxedCaching(boolean keepIfNotDirty,
long timeout)
- Create new RelaxedCaching action
- Parameters:
timeout
- before we check the validity of an entrykeepIfNotDirty
- true if non-dirty entries must be kept in the cache
getCacheEntry
public AbstractResultCacheEntry getCacheEntry(SelectRequest sqlQuery,
ControllerResultSet result,
AbstractResultCache cache)
- Description copied from class:
CacheBehavior
- Builds a cache entry from a
SelectRequest
and a
ControllerResultSet
. This cache entry can then be inserted
in the cache.
- Specified by:
getCacheEntry
in class CacheBehavior
- Parameters:
sqlQuery
- entry to add in the cacheresult
- value to add in the cachecache
- reference for EagerCaching in case the entry needs to remove
itself from the cache.
- Returns:
- the query cache entry to add to the cache
- See Also:
CacheBehavior.getCacheEntry(SelectRequest,
ControllerResultSet, AbstractResultCache)
getXml
public java.lang.String getXml()
- Description copied from class:
CacheBehavior
- Implementation specific xml dump of the cache behavior.
- Specified by:
getXml
in class CacheBehavior
- Returns:
- xml dump of the cache behavior
- See Also:
XmlComponent.getXml()
Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.