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 voidaddEntry(T id, String name)Add the entry to the local cachevoidclearLocalMaps()Clear anything cached in thread-local (after transaction rollback, for example)Collection<String>getAllNames()Get all names in the cacheStringgetName(T id)Get the name for the given idvoidprefill(Map<T,String> 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
-
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)
-
-