Interface IIdNameCache<T>
-
- Type Parameters:
T
-
- All Known Implementing Classes:
IdNameCache
public interface IIdNameCache<T>
Interface to a cache mapping an id of type T to a string. Supports thread-local caching to support temporary staging of values pending successful completion of a transaction.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addEntry(T id, String name)
Add the entry to the local cachevoid
clearLocalMaps()
Clear anything cached in thread-local (after transaction rollback, for example)Collection<String>
getAllNames()
Get all names in the cacheString
getName(T id)
Get the name for the given idvoid
prefill(Map<T,String> content)
Prefill the shared map with the given content (must come data already committed in the database)void
reset()
Clear both local shared caches - useful for unit testsvoid
updateSharedMaps()
Called after a transaction commit() to transfer all the staged (thread-local) data over to the shared cache.
-
-
-
Method Detail
-
getAllNames
Collection<String> getAllNames()
Get all names in the cache- Returns:
-
updateSharedMaps
void updateSharedMaps()
Called after a transaction commit() to transfer all the staged (thread-local) data over to the shared cache.
-
reset
void reset()
Clear both local shared caches - useful for unit tests
-
clearLocalMaps
void clearLocalMaps()
Clear anything cached in thread-local (after transaction rollback, for example)
-
-