クラス org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique

org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUniqueに対する継承グラフ

Inheritance graph
[凡例]
org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUniqueのコラボレーション図

Collaboration graph
[凡例]
すべてのメンバ一覧

説明

This is a query cache implementation with a column unique granularity:

作者:
Emmanuel Cecchet

Nicolas Modrzyk

バージョン:
1.0

ResultCacheColumnUnique.java55 行で定義されています。

Public メソッド

 ResultCacheColumnUnique (int maxEntries, int pendingTimeout)
void processAddToCache (CacheEntry qe)
boolean isUpdateNecessary (UpdateRequest request)
String getName ()

Protected メソッド

void processWriteNotify (AbstractWriteRequest request)


コンストラクタとデストラクタ

org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.ResultCacheColumnUnique int  maxEntries,
int  pendingTimeout
 

Builds a new ResultCache with a column unique granularity.

引数:
maxEntries maximum number of entries
pendingTimeout pending timeout for concurrent queries
ResultCacheColumnUnique.java64 行で定義されています。
00065 { 00066 super(maxEntries, pendingTimeout); 00067 parsingGranularity = ParsingGranularities.COLUMN_UNIQUE; 00068 }


メソッド

String org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.getName  )  [virtual]
 

参照:
org.objectweb.cjdbc.controller.cache.result.ResultCache.getName()

org.objectweb.cjdbc.controller.cache.result.ResultCacheを実装しています.

ResultCacheColumnUnique.java227 行で定義されています。

00228 { 00229 return "columnUnique"; 00230 }

boolean org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.isUpdateNecessary UpdateRequest  request  )  [virtual]
 

参照:
org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.isUpdateNecessary(org.objectweb.cjdbc.common.sql.UpdateRequest)

org.objectweb.cjdbc.controller.cache.result.ResultCacheを実装しています.

ResultCacheColumnUnique.java132 行で定義されています。

参照先 org.objectweb.cjdbc.common.sql.AbstractRequest.getCacheAbility(), org.objectweb.cjdbc.common.sql.AbstractWriteRequest.getColumns(), org.objectweb.cjdbc.common.sql.AbstractWriteRequest.getPk(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getPkResultCacheEntry(), org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getResult(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.getTable(), org.objectweb.cjdbc.common.sql.AbstractWriteRequest.getTableName(), org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.isValid(), と org.objectweb.cjdbc.controller.cache.result.ResultCache.needInvalidate().

00133 { 00134 if (request.getCacheAbility() != RequestType.UNIQUE_CACHEABLE) 00135 return true; 00136 CacheDatabaseTable cacheTable = cdbs.getTable(request.getTableName()); 00137 if (request.getColumns() == null) 00138 return true; 00139 String pk = request.getPk(); 00140 ResultCacheEntry qce = cacheTable.getPkResultCacheEntry(pk); 00141 if (qce != null) 00142 { 00143 if (!qce.isValid()) 00144 return true; 00145 ControllerResultSet rs = qce.getResult(); 00146 if (rs == null) 00147 return true; 00148 else 00149 return needInvalidate(rs, request)[1]; 00150 } 00151 else 00152 return true; 00153 }

void org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processAddToCache CacheEntry  qe  )  [virtual]
 

参照:
org.objectweb.cjdbc.controller.cache.result.ResultCache.processAddToCache(CacheEntry)

org.objectweb.cjdbc.controller.cache.result.ResultCacheを実装しています.

ResultCacheColumnUnique.java73 行で定義されています。

参照先 org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseColumn.addCacheEntry(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.addCacheEntry(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.addPkCacheEntry(), org.objectweb.cjdbc.common.sql.AbstractRequest.getCacheAbility(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getColumn(), org.objectweb.cjdbc.common.sql.schema.TableColumn.getColumnName(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getColumns(), org.objectweb.cjdbc.common.sql.SelectRequest.getFrom(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getPkResultCacheEntry(), org.objectweb.cjdbc.common.sql.SelectRequest.getPkValue(), org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getRequest(), org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.getRequest(), org.objectweb.cjdbc.common.sql.SelectRequest.getSelect(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.getTable(), org.objectweb.cjdbc.common.sql.schema.TableColumn.getTableName(), org.objectweb.cjdbc.common.sql.SelectRequest.getWhere(), org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.isValid(), と org.objectweb.cjdbc.common.log.Trace.warn().

00074 { 00075 SelectRequest request = qe.getRequest(); 00076 ArrayList selectedColumns = request.getSelect(); 00077 // Update the tables columns dependencies 00078 if (selectedColumns == null || selectedColumns.isEmpty()) 00079 { 00080 logger 00081 .warn("No parsing of select clause found - Fallback to table granularity"); 00082 for (Iterator i = request.getFrom().iterator(); i.hasNext();) 00083 { 00084 CacheDatabaseTable table = cdbs.getTable((String) i.next()); 00085 table.addCacheEntry(qe); 00086 // Add all columns, entries will be added below. 00087 ArrayList columns = table.getColumns(); 00088 for (int j = 0; j < columns.size(); j++) 00089 { 00090 ((CacheDatabaseColumn) columns.get(j)).addCacheEntry(qe); 00091 } 00092 return; 00093 } 00094 } 00095 for (Iterator i = request.getSelect().iterator(); i.hasNext();) 00096 { 00097 TableColumn tc = (TableColumn) i.next(); 00098 cdbs.getTable(tc.getTableName()).getColumn(tc.getColumnName()) 00099 .addCacheEntry(qe); 00100 } 00101 if (request.getWhere() != null) 00102 { // Add all columns dependencies 00103 for (Iterator i = request.getWhere().iterator(); i.hasNext();) 00104 { 00105 TableColumn tc = (TableColumn) i.next(); 00106 cdbs.getTable(tc.getTableName()).getColumn(tc.getColumnName()) 00107 .addCacheEntry(qe); 00108 } 00109 if (request.getCacheAbility() == RequestType.UNIQUE_CACHEABLE) 00110 { // Add a specific entry for this pk 00111 String tableName = (String) request.getFrom().get(0); 00112 ResultCacheEntry entry = cdbs.getTable(tableName) 00113 .getPkResultCacheEntry(request.getPkValue()); 00114 if (entry != null) 00115 { 00116 if (entry.isValid()) 00117 { // Do not add an entry which has a lower selection than the current 00118 // one 00119 if (entry.getRequest().getSelect().size() >= request.getSelect() 00120 .size()) 00121 return; 00122 } 00123 } 00124 cdbs.getTable(tableName).addPkCacheEntry(request.getPkValue(), qe); 00125 } 00126 } 00127 }

void org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processWriteNotify AbstractWriteRequest  request  )  [protected, virtual]
 

参照:
org.objectweb.cjdbc.controller.cache.result.ResultCache.processWriteNotify(org.objectweb.cjdbc.common.sql.AbstractWriteRequest)

org.objectweb.cjdbc.controller.cache.result.ResultCacheを実装しています.

ResultCacheColumnUnique.java158 行で定義されています。

参照先 org.objectweb.cjdbc.common.log.Trace.debug(), org.objectweb.cjdbc.common.sql.AbstractRequest.getCacheAbility(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getColumn(), org.objectweb.cjdbc.common.sql.schema.TableColumn.getColumnName(), org.objectweb.cjdbc.common.sql.AbstractWriteRequest.getColumns(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.getPkResultCacheEntry(), org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getResult(), org.objectweb.cjdbc.common.sql.AbstractRequest.getSQL(), org.objectweb.cjdbc.common.sql.AbstractRequest.getSQLShortForm(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema.getTable(), org.objectweb.cjdbc.common.sql.schema.TableColumn.getTableName(), org.objectweb.cjdbc.common.sql.AbstractWriteRequest.getTableName(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseColumn.invalidateAll(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.invalidateAll(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseColumn.invalidateAllNonUnique(), org.objectweb.cjdbc.common.sql.AbstractWriteRequest.isAlter(), org.objectweb.cjdbc.common.log.Trace.isDebugEnabled(), org.objectweb.cjdbc.common.sql.AbstractWriteRequest.isDelete(), org.objectweb.cjdbc.common.sql.AbstractWriteRequest.isInsert(), org.objectweb.cjdbc.common.sql.AbstractWriteRequest.isUpdate(), org.objectweb.cjdbc.controller.cache.result.ResultCache.needInvalidate(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.removePkResultCacheEntry(), と org.objectweb.cjdbc.common.log.Trace.warn().

00159 { 00160 // Sanity check 00161 CacheDatabaseTable cacheTable = cdbs.getTable(request.getTableName()); 00162 if (request.getColumns() == null) 00163 { 00164 logger.warn("No column parsing found - Fallback to table granularity (" 00165 + request.getSQL() + ")"); 00166 cacheTable.invalidateAll(); 00167 return; 00168 } 00169 if (request.isInsert()) 00170 { 00171 for (Iterator i = request.getColumns().iterator(); i.hasNext();) 00172 { 00173 TableColumn tc = (TableColumn) i.next(); 00174 cdbs.getTable(tc.getTableName()).getColumn(tc.getColumnName()) 00175 .invalidateAllNonUnique(); 00176 } 00177 } 00178 else 00179 { 00180 if (request.getCacheAbility() == RequestType.UNIQUE_CACHEABLE) 00181 { 00182 if (request.isUpdate()) 00183 { 00184 String pk = ((UpdateRequest) request).getPk(); 00185 ResultCacheEntry qce = cacheTable.getPkResultCacheEntry(pk); 00186 if (qce != null) 00187 { 00188 boolean[] invalidate = needInvalidate(qce.getResult(), 00189 (UpdateRequest) request); 00190 if (invalidate[0]) 00191 { // We must invalidate this entry 00192 cacheTable.removePkResultCacheEntry(pk); 00193 return; 00194 } 00195 else 00196 { 00197 if (logger.isDebugEnabled()) 00198 logger.debug("No invalidate needed for request:" 00199 + request.getSQLShortForm(20)); 00200 return; // We don't need to invalidate 00201 } 00202 } 00203 } 00204 else if (request.isDelete()) 00205 { // Invalidate the corresponding cache entry 00206 cacheTable 00207 .removePkResultCacheEntry(((DeleteRequest) request).getPk()); 00208 return; 00209 } 00210 } 00211 // At this point this is a non unique write query or a request 00212 // we didn't handle properly (unknown request for example) 00213 for (Iterator i = request.getColumns().iterator(); i.hasNext();) 00214 { 00215 TableColumn tc = (TableColumn) i.next(); 00216 CacheDatabaseTable table = cdbs.getTable(tc.getTableName()); 00217 table.invalidateAll(); // Pk are associated to tables 00218 if (!request.isAlter()) 00219 table.getColumn(tc.getColumnName()).invalidateAll(); 00220 } 00221 } 00222 }


このクラスの説明は次のファイルから生成されました:
CJDBCversion1.0.4に対してTue Oct 12 15:16:37 2004に生成されました。 doxygen 1.3.8