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