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 voidaddEntry(String key, T id)Add the resource type to the local cachevoidclearLocalMaps()Clear anything cached in thread-local (after transaction rollback, for example)Collection<T>getAllIds()Get all resource type identifiers in the cacheTgetId(String resourceType)Get the resource type identifier for the given resourceType namevoidprefill(Map<String,T> content)Prefill the shared map with the given content (must come data already committed in the database)voidreset()Clear both local shared caches - useful for unit testsvoidupdateSharedMaps()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:
-
getAllIds
Collection<T> getAllIds()
Get all resource type identifiers in the cache- 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)
-
-