Module com.aoapps.dao.base
Package com.aoapps.dao.base
Class GlobalCacheTable<K extends Comparable<? super K>,R extends Row<K,?>>
java.lang.Object
com.aoapps.dao.base.AbstractTable<K,R>
com.aoapps.dao.base.GlobalCacheTable<K,R>
- All Implemented Interfaces:
Table<K,
,R> Iterable<R>
,Collection<R>
public abstract class GlobalCacheTable<K extends Comparable<? super K>,R extends Row<K,?>>
extends AbstractTable<K,R>
Caches results by querying the entire table upon first use, the cache is
persistent and shared by all users.
- All rows are loaded and stored unsorted
- allRowsLoaded is called, given unsorted rows
- Map is built upon first call to get(K)
- Rows are sorted upon first call to getRows
-
Field Summary
Fields inherited from class com.aoapps.dao.base.AbstractTable
map, sortedMap
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
allRowsLoaded
(Set<? extends R> rows) Called when all rows have been loaded at once.getRows()
void
Clears the global caches when the table is updated.Methods inherited from class com.aoapps.dao.base.AbstractTable
getMap, getModel, getSortedMap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
Methods inherited from interface com.aoapps.dao.Table
add, addAll, canonicalize, clear, clearCaches, contains, containsAll, getIterator, getName, getOrderedRows, getRows, getSize, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
-
Constructor Details
-
GlobalCacheTable
-
-
Method Details
-
tableUpdated
public void tableUpdated()Clears the global caches when the table is updated. -
getUnsortedRows
- Throws:
SQLException
-
allRowsLoaded
Called when all rows have been loaded at once. This allows for subclasses to populate any views or caches.This default implementation does nothing.
- Throws:
SQLException
-
getRows
- Throws:
SQLException
-
get
- Throws:
NoRowException
SQLException
-
getRowsNoCache
- Throws:
SQLException
-