Class IdNameCache<T>
- java.lang.Object
-
- com.ibm.fhir.persistence.jdbc.cache.IdNameCache<T>
-
- Type Parameters:
T
- the type of the key value held by the cache
- All Implemented Interfaces:
IIdNameCache<T>
public class IdNameCache<T> extends java.lang.Object implements IIdNameCache<T>
-
-
Constructor Summary
Constructors Constructor Description IdNameCache()
Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEntry(T id, java.lang.String name)
Add the entry to the local cachevoid
clearLocalMaps()
Clear anything cached in thread-local (after transaction rollback, for example)java.util.Collection<java.lang.String>
getAllNames()
Get all names in the cachejava.lang.String
getName(T key)
Get the name for the given idvoid
prefill(java.util.Map<T,java.lang.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
-
updateSharedMaps
public void updateSharedMaps()
Description copied from interface:IIdNameCache
Called after a transaction commit() to transfer all the staged (thread-local) data over to the shared cache.- Specified by:
updateSharedMaps
in interfaceIIdNameCache<T>
-
getName
public java.lang.String getName(T key)
Description copied from interface:IIdNameCache
Get the name for the given id- Specified by:
getName
in interfaceIIdNameCache<T>
- Returns:
-
getAllNames
public java.util.Collection<java.lang.String> getAllNames()
Description copied from interface:IIdNameCache
Get all names in the cache- Specified by:
getAllNames
in interfaceIIdNameCache<T>
- Returns:
-
addEntry
public void addEntry(T id, java.lang.String name)
Description copied from interface:IIdNameCache
Add the entry to the local cache- Specified by:
addEntry
in interfaceIIdNameCache<T>
-
reset
public void reset()
Description copied from interface:IIdNameCache
Clear both local shared caches - useful for unit tests- Specified by:
reset
in interfaceIIdNameCache<T>
-
clearLocalMaps
public void clearLocalMaps()
Description copied from interface:IIdNameCache
Clear anything cached in thread-local (after transaction rollback, for example)- Specified by:
clearLocalMaps
in interfaceIIdNameCache<T>
-
prefill
public void prefill(java.util.Map<T,java.lang.String> content)
Description copied from interface:IIdNameCache
Prefill the shared map with the given content (must come data already committed in the database)- Specified by:
prefill
in interfaceIIdNameCache<T>
-
-