Class CommonTokenValuesCacheImpl
- java.lang.Object
- 
- com.ibm.fhir.persistence.jdbc.cache.CommonTokenValuesCacheImpl
 
- 
- All Implemented Interfaces:
- ICommonTokenValuesCache
 
 public class CommonTokenValuesCacheImpl extends Object implements ICommonTokenValuesCache Implementation of a cache used for lookups of entities related to local and external resource references
- 
- 
Constructor SummaryConstructors Constructor Description CommonTokenValuesCacheImpl(int codeSystemCacheSize, int tokenValueCacheSize)Public constructor
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCodeSystem(String codeSystem, int id)Add the id to the local cachevoidaddTokenValue(CommonTokenValue key, long id)Add the CommonTokenValue and id to the local cachevoidclearLocalMaps()Clear any thread-local cache maps (probably because a transaction was rolled back)IntegergetCodeSystemId(String codeSystem)Look up the id of the named codeSystemvoidprefillCodeSystems(Map<String,Integer> codeSystems)Add the contents of the given codeSystems map to the shared cache.voidreset()Clear the thread-local and shared caches (for test purposes)voidresolveCodeSystems(Collection<ResourceTokenValueRec> tokenValues, List<ResourceTokenValueRec> misses)Lookup all the database values we have cached for the code-system names in the given collection.voidresolveTokenValues(Collection<ResourceTokenValueRec> tokenValues, List<ResourceTokenValueRec> misses)Look up the ids for the common token values.voidupdateSharedMaps()Called after a transaction commit() to transfer all the staged (thread-local) data over to the shared LRU cache.
 
- 
- 
- 
Method Detail- 
updateSharedMapspublic void updateSharedMaps() Called after a transaction commit() to transfer all the staged (thread-local) data over to the shared LRU cache.- Specified by:
- updateSharedMapsin interface- ICommonTokenValuesCache
 
 - 
getCodeSystemIdpublic Integer getCodeSystemId(String codeSystem) Description copied from interface:ICommonTokenValuesCacheLook up the id of the named codeSystem- Specified by:
- getCodeSystemIdin interface- ICommonTokenValuesCache
- Returns:
- the database identity of the code system, or null if no record was found
 
 - 
resolveCodeSystemspublic void resolveCodeSystems(Collection<ResourceTokenValueRec> tokenValues, List<ResourceTokenValueRec> misses) Description copied from interface:ICommonTokenValuesCacheLookup all the database values we have cached for the code-system names in the given collection. Put any objects with cache misses into the corresponding miss lists (so that we know which records we need to generate inserts for)- Specified by:
- resolveCodeSystemsin interface- ICommonTokenValuesCache
- misses- the objects we couldn't find in the cache
 
 - 
resolveTokenValuespublic void resolveTokenValues(Collection<ResourceTokenValueRec> tokenValues, List<ResourceTokenValueRec> misses) Description copied from interface:ICommonTokenValuesCacheLook up the ids for the common token values. Must be preceded by resolveCodeSystems to make sure we have code-system ids set for each record. This also means that code-systems which don't yet exist must be created before this method can be called (because we need the id)- Specified by:
- resolveTokenValuesin interface- ICommonTokenValuesCache
 
 - 
addCodeSystempublic void addCodeSystem(String codeSystem, int id) Description copied from interface:ICommonTokenValuesCacheAdd the id to the local cache- Specified by:
- addCodeSystemin interface- ICommonTokenValuesCache
 
 - 
addTokenValuepublic void addTokenValue(CommonTokenValue key, long id) Description copied from interface:ICommonTokenValuesCacheAdd the CommonTokenValue and id to the local cache- Specified by:
- addTokenValuein interface- ICommonTokenValuesCache
 
 - 
resetpublic void reset() Description copied from interface:ICommonTokenValuesCacheClear the thread-local and shared caches (for test purposes)- Specified by:
- resetin interface- ICommonTokenValuesCache
 
 - 
clearLocalMapspublic void clearLocalMaps() Description copied from interface:ICommonTokenValuesCacheClear any thread-local cache maps (probably because a transaction was rolled back)- Specified by:
- clearLocalMapsin interface- ICommonTokenValuesCache
 
 - 
prefillCodeSystemspublic void prefillCodeSystems(Map<String,Integer> codeSystems) Description copied from interface:ICommonTokenValuesCacheAdd the contents of the given codeSystems map to the shared cache. It is assumed that all of these ids are already committed in the database, not newly inserted as part of the current transaction.- Specified by:
- prefillCodeSystemsin interface- ICommonTokenValuesCache
 
 
- 
 
-