|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ov4j.cache.CacheHandler
public class CacheHandler
This class will handle caching results of calls.
| Field Summary | |
|---|---|
protected static java.lang.String |
CACHE_AUTHOR
Author used when caching. |
protected static int |
CACHE_VERSION_ROLLOVER
Number of versions to keep in history. |
protected static java.lang.String |
ERROR_COMMENT
Comment for error. |
protected static java.lang.String |
NORMAL_COMMENT
Comment on normal cache. |
protected static java.lang.String |
TIMEOUT_COMMENT
Comment for timeouts |
| Constructor Summary | |
|---|---|
CacheHandler(IContainer<ClassComparable,CachedResultId> cont)
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
addListener(ICacheHandlerListener listener)
Register listener for notifications. |
protected void |
addNCommit(CachedResultId id,
Version<ClassComparable> result)
Add result to cache. |
Version<ClassComparable> |
cachedCall(java.lang.reflect.Method theMethod,
java.lang.Object instance,
java.lang.Object... args)
Perform a cached call, will wait for a period of time before returning the result from the cache if it exists. |
void |
clear()
Clear the cache. |
void |
close()
Close the cache. |
protected void |
commit(CachedResultId id,
Version<ClassComparable> result)
Commit the result in cache. |
long |
getDelayedCacheTimeout()
|
long |
getTimeout()
|
int |
getVersionRollover()
|
protected Version<ClassComparable> |
latest(CachedResultId id)
Fetch latest result for the given ID. |
boolean |
removeListener(ICacheHandlerListener listener)
Unregister listener for notifications. |
void |
setDelayedCacheTimeout(long delayedCacheTimeout)
|
void |
setTimeout(long timeout)
|
void |
setVersionRollover(int versionRollover)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String CACHE_AUTHOR
protected static final java.lang.String NORMAL_COMMENT
protected static final java.lang.String TIMEOUT_COMMENT
protected static final java.lang.String ERROR_COMMENT
protected static final int CACHE_VERSION_ROLLOVER
| Constructor Detail |
|---|
public CacheHandler(IContainer<ClassComparable,CachedResultId> cont)
cont - Container to used for storing data.| Method Detail |
|---|
public boolean addListener(ICacheHandlerListener listener)
listener - Listener to be added.
protected void addNCommit(CachedResultId id,
Version<ClassComparable> result)
throws java.io.IOException
id - ID to use for storing result.result - Result to be stored.
java.io.IOException
public Version<ClassComparable> cachedCall(java.lang.reflect.Method theMethod,
java.lang.Object instance,
java.lang.Object... args)
theMethod - Method to be called.instance - Object on which the method should be called.args - Arguments to pass to the method call.
public void clear()
public void close()
protected void commit(CachedResultId id,
Version<ClassComparable> result)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.ClassNotFoundException,
java.io.IOException
id - ID to used for storing result.result - Result to be stored.
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.io.IOExceptionpublic long getDelayedCacheTimeout()
public long getTimeout()
public int getVersionRollover()
protected Version<ClassComparable> latest(CachedResultId id)
id - ID to be fetched.
public boolean removeListener(ICacheHandlerListener listener)
listener - Listener to be removed.
public void setDelayedCacheTimeout(long delayedCacheTimeout)
delayedCacheTimeout - The delayedCacheTimeout to set.public void setTimeout(long timeout)
timeout - The timeout to set.public void setVersionRollover(int versionRollover)
versionRollover - The version rollover to set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||