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(java.lang.String key, T id)
Add the resource type to the local cachevoid
clearLocalMaps()
Clear anything cached in thread-local (after transaction rollback, for example)java.util.Collection<T>
getAllIds()
Get all resource type identifiers in the cacheT
getId(java.lang.String resourceType)
Get the resource type identifier for the given resourceType namevoid
prefill(java.util.Map<java.lang.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(java.lang.String resourceType)
Get the resource type identifier for the given resourceType name- Parameters:
resourceType
-- Returns:
-
getAllIds
java.util.Collection<T> getAllIds()
Get all resource type identifiers in the cache- Returns:
-
addEntry
void addEntry(java.lang.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)
-
prefill
void prefill(java.util.Map<java.lang.String,T> content)
Prefill the shared map with the given content (must come data already committed in the database)- Parameters:
content
-
-
-