Module com.aoapps.dao.base
Package com.aoapps.dao.base
Class RowCacheTable<K extends Comparable<? super K>,R extends Row<K,?>>
java.lang.Object
com.aoapps.dao.base.AbstractTable<K,R>
com.aoapps.dao.base.RowCacheTable<K,R>
- All Implemented Interfaces:
Table<K,,R> Iterable<R>,Collection<R>
public abstract class RowCacheTable<K extends Comparable<? super K>,R extends Row<K,?>>
extends AbstractTable<K,R>
Caches results on a per-row basis.
-
Field Summary
FieldsFields inherited from class com.aoapps.dao.base.AbstractTable
map, sortedMap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToCache(K canonicalKey, R row) Adds a single object to the cache.protected voidallRowsLoaded(Set<? extends R> rows) Called when all rows have been loaded at once.voidClears all caches for the current thread.protected abstract RgetNoCache(K canonicalKey) getRows()voidWhen the table is updated, all caches are cleared for the current thread.Methods inherited from class com.aoapps.dao.base.AbstractTable
getMap, getModel, getSortedMapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArrayMethods inherited from interface com.aoapps.dao.Table
add, addAll, canonicalize, clear, contains, containsAll, getIterator, getName, getOrderedRows, getRows, getSize, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
-
Field Details
-
unsortedRowsCache
-
-
Constructor Details
-
RowCacheTable
-
-
Method Details
-
clearCaches
public void clearCaches()Clears all caches for the current thread. -
tableUpdated
public void tableUpdated()When the table is updated, all caches are cleared for the current thread. -
getUnsortedRows
- Throws:
SQLException
-
allRowsLoaded
Called when all rows have been loaded at once. This allows for subclasses to populate any views or caches in a more efficient manner than row-by-row.This default implementation does nothing.
- Throws:
SQLException
-
getRows
- Throws:
SQLException
-
get
- Throws:
NoRowExceptionSQLException
-
addToCache
Adds a single object to the cache. -
getNoCache
- Throws:
NoRowExceptionSQLException
-
getRowsNoCache
- Throws:
SQLException
-
