|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.cjdbc.controller.cache.result.AbstractResultCache
This class defines the minimal functionnalities that a request cache must provide.
Only read requests (SELECTs) can be cached, there is no
sense to cache writes as they do not provide any result to cache. However,
the cache must be notified of the write queries in order to maintain cache
coherency.
| Field Summary | |
protected static Trace |
logger
Logger instance. |
protected int |
parsingGranularity
Parsing granularity. |
| Fields inherited from interface org.objectweb.cjdbc.common.xml.XmlComponent |
DOCTYPE_DB, XML_VERSION |
| Constructor Summary | |
AbstractResultCache()
|
|
| Method Summary | |
abstract void |
addCachingRule(ResultCacheRule rule)
Add precise management and configuration of the cache behavior. |
abstract void |
addToCache(SelectRequest request,
ControllerResultSet result)
Adds an entry request/reply to the cache. |
abstract void |
commit(long transactionId)
Commit a transaction given its id. |
abstract void |
flushCache()
Removes all entries from the cache. |
abstract java.lang.String[][] |
getCacheData()
Returns the content of the cache as displayable array of array of string |
abstract long |
getCacheSize()
Returns number of entries in the cache |
abstract CacheStatistics |
getCacheStatistics()
Returns pointer to the stats collector |
abstract java.lang.String[][] |
getCacheStatsData()
Returns a bunch of stats collected by the cache, such as cache hits. |
abstract ResultCacheRule |
getDefaultRule()
Return the default cache rule |
abstract CacheEntry |
getFromCache(SelectRequest request,
boolean addToPendingQueries)
Gets the result to the given request from the cache. |
int |
getParsingGranularity()
Gets the needed query parsing granularity. |
java.lang.String |
getXml()
Get xml formatted representation of this cjdbc component |
protected abstract java.lang.String |
getXmlImpl()
Gets information about the request cache in xml |
abstract boolean |
isUpdateNecessary(UpdateRequest request)
Returns true if the cache does not contain the values that are given in the update statement. |
void |
mergeDatabaseSchema(DatabaseSchema dbs)
Merge the given DatabaseSchema with the current one. |
abstract void |
removeFromCache(SelectRequest request)
Removes an entry from the cache (both request and reply are dropped). |
abstract void |
removeFromPendingQueries(SelectRequest request)
Removes an entry from the pending query list. |
abstract void |
rollback(long transactionId)
Rollback a transaction given its id. |
void |
setDatabaseSchema(DatabaseSchema dbs)
Sets the DatabaseSchema of the current virtual database. |
abstract void |
setDefaultRule(ResultCacheRule defaultRule)
Set the default query rule |
void |
setParsingGranularity(int parsingGranularity)
Sets the needed query parsing granularity. |
abstract void |
writeNotify(AbstractWriteRequest request)
Notifies the cache that the given write request has been issued, so that cache coherency can be maintained. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected int parsingGranularity
ParsingGranularities.NO_PARSING.
protected static Trace logger
| Constructor Detail |
public AbstractResultCache()
| Method Detail |
public int getParsingGranularity()
setParsingGranularity(int)public void setParsingGranularity(int parsingGranularity)
parsingGranularity - the query parsing granularity to setgetParsingGranularity()public void setDatabaseSchema(DatabaseSchema dbs)
DatabaseSchema of the current virtual database.
dbs - a DatabaseSchema valueCacheDatabaseSchemapublic void mergeDatabaseSchema(DatabaseSchema dbs)
DatabaseSchema with the current one.
dbs - a DatabaseSchema valueCacheDatabaseSchemapublic abstract void addCachingRule(ResultCacheRule rule)
rule - of action for the cacheResultCacheRulepublic abstract ResultCacheRule getDefaultRule()
public abstract void setDefaultRule(ResultCacheRule defaultRule)
defaultRule - default rule to set
public abstract void addToCache(SelectRequest request,
ControllerResultSet result)
throws CacheException
request - the requestresult - the result corresponding to the request
CacheException - if an error occurs
public abstract CacheEntry getFromCache(SelectRequest request,
boolean addToPendingQueries)
The returned ResultCacheEntry is null if the
request is not present in the cache.
An invalid CacheEntry may be returned (it means that the
result is null) but the already parsed query can be
retrieved from the cache entry.
request - an SQL select requestaddToPendingQueries - true if the request must be added to the pending
query list on a cache miss
ResultCacheEntry if found, else nullpublic abstract void removeFromCache(SelectRequest request)
request - a SelectRequestpublic abstract void removeFromPendingQueries(SelectRequest request)
request - a SelectRequest
public abstract void writeNotify(AbstractWriteRequest request)
throws CacheException
request - an AbstractWriteRequest value
CacheException - if an error occurs
public abstract boolean isUpdateNecessary(UpdateRequest request)
throws CacheException
request - the update request that needs to be executed
CacheException - if an error occurspublic abstract void flushCache()
public abstract void commit(long transactionId)
throws CacheException
transactionId - the transaction id
CacheException - if an error occurs
public abstract void rollback(long transactionId)
throws CacheException
transactionId - the transaction id
CacheException - if an error occursprotected abstract java.lang.String getXmlImpl()
String containing informationpublic java.lang.String getXml()
XmlComponent
getXml in interface XmlComponentXmlComponent.getXml()
public abstract java.lang.String[][] getCacheData()
throws CacheException
CacheException - if fails
public abstract java.lang.String[][] getCacheStatsData()
throws CacheException
CacheException - if fails to collect the data.public abstract CacheStatistics getCacheStatistics()
CacheStatistics objectpublic abstract long getCacheSize()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||