|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openware.job.data.QueryCache
Cache queries.
Queries are cached by the table name and where clause of the query. The cache's size can be set in terms of number of queries cached. This value defaults to 100 but can be changed in the constructor. When a new query needs to be cached and the cache is full the least recently used query is removed and the new one put in its place.
Constructor Summary | |
QueryCache()
|
|
QueryCache(int maxSize)
|
Method Summary | |
void |
addToCache(TableRow tableRow,
java.lang.String query,
java.lang.String[] joinTables,
java.util.Collection results)
Add query results to the cache. |
java.util.Collection |
getFromCache(TableRow tableRow,
java.lang.String query)
Get query results from the cache. |
void |
invalidateCache(CacheInvalidationInfo cacheInfo)
The database has been updated and now we need to invalidate certain parts of the cache. |
void |
invalidateCacheForTableName(java.lang.String tablename)
|
void |
purgeCache()
Remove all of the cached queries. |
void |
setCacheSize(int maxSize)
Set the maximum size for the cache. |
void |
setDebugMode(boolean mode)
Set the debug mode. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public QueryCache()
public QueryCache(int maxSize)
Method Detail |
public java.util.Collection getFromCache(TableRow tableRow, java.lang.String query) throws PersistException
If the cache doesn't contain the results then null
is returned.
tableRow
- Information about the table that we are
looking the results in.query
- The query by which the results are cached.public void setCacheSize(int maxSize)
This value defaults to 100.
maxSize
- The maximum size of the cache.public void setDebugMode(boolean mode)
true
to this method.
This method is normally going to be called by the
PersistentManager
when the call is made to set
the query cache. If you want to override the settings for
the PersistentManager call this method after you have
called the setQueryCache
method in the
PersistentManager
.
mode
- true
if you want to print debugging
information to stdout, false
otherwise.public void addToCache(TableRow tableRow, java.lang.String query, java.lang.String[] joinTables, java.util.Collection results)
tableRow
- Information about the table that we are
caching the results for.query
- The query by which we are going to cache
the results.results
- The actual results to cache.public void invalidateCacheForTableName(java.lang.String tablename)
public void invalidateCache(CacheInvalidationInfo cacheInfo)
cacheInfo
- The object that contains the information on
which parts of the cache to purge.public void purgeCache()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |