Interface INameIdCache<T>
-
- Type Parameters:
T
-
- All Known Implementing Classes:
NameIdCache
public interface INameIdCache<T>
Interface to a cache mapping a string to a value of type T. 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(String key, T id)
Add the resource type to the local cachevoid
clearLocalMaps()
Clear anything cached in thread-local (after transaction rollback, for example)T
getId(String resourceType)
Get the resource type identifier for the given resourceType namevoid
prefill(Map<String,T> 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
-
getId
T getId(String resourceType)
Get the resource type identifier for the given resourceType name- Parameters:
resourceType
-- Returns:
-
addEntry
void addEntry(String key, T id)
Add the resource type to the local cache- Parameters:
resourceType
-resourceTypeId
-
-
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)
-
-