Class LogicalResourceIdentCacheImpl
- java.lang.Object
-
- org.linuxforhealth.fhir.persistence.jdbc.cache.LogicalResourceIdentCacheImpl
-
- All Implemented Interfaces:
ILogicalResourceIdentCache
public class LogicalResourceIdentCacheImpl extends java.lang.Object implements ILogicalResourceIdentCache
Implementation of a cache used for lookups of entities related to local and external resource references
-
-
Constructor Summary
Constructors Constructor Description LogicalResourceIdentCacheImpl(int logicalResourceCacheSize)Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRecord(LogicalResourceIdentKey key, long id)Add the LogicalResourceIdent key and id to the local cachevoidclearLocalMaps()Clear any thread-local cache maps (probably because a transaction was rolled back)java.lang.LonggetLogicalResourceId(int resourceTypeId, java.lang.String logicalId)Get the database logical_resourc_id for the given resource type and logicalIdvoidreset()Clear the thread-local and shared caches (for test purposes)voidresolveReferenceValues(java.util.Collection<ResourceReferenceValueRec> values, java.util.List<ResourceReferenceValueRec> misses)Lookup all the database values we have cached for the given collection.voidupdateSharedMaps()Called after a transaction commit() to transfer all the staged (thread-local) data over to the shared LRU cache.
-
-
-
Method Detail
-
updateSharedMaps
public void updateSharedMaps()
Called after a transaction commit() to transfer all the staged (thread-local) data over to the shared LRU cache.- Specified by:
updateSharedMapsin interfaceILogicalResourceIdentCache
-
getLogicalResourceId
public java.lang.Long getLogicalResourceId(int resourceTypeId, java.lang.String logicalId)Description copied from interface:ILogicalResourceIdentCacheGet the database logical_resourc_id for the given resource type and logicalId- Specified by:
getLogicalResourceIdin interfaceILogicalResourceIdentCache- Returns:
-
resolveReferenceValues
public void resolveReferenceValues(java.util.Collection<ResourceReferenceValueRec> values, java.util.List<ResourceReferenceValueRec> misses)
Description copied from interface:ILogicalResourceIdentCacheLookup all the database values we have cached for 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:
resolveReferenceValuesin interfaceILogicalResourceIdentCachemisses- the objects we couldn't find in the cache
-
addRecord
public void addRecord(LogicalResourceIdentKey key, long id)
Description copied from interface:ILogicalResourceIdentCacheAdd the LogicalResourceIdent key and id to the local cache- Specified by:
addRecordin interfaceILogicalResourceIdentCache
-
reset
public void reset()
Description copied from interface:ILogicalResourceIdentCacheClear the thread-local and shared caches (for test purposes)- Specified by:
resetin interfaceILogicalResourceIdentCache
-
clearLocalMaps
public void clearLocalMaps()
Description copied from interface:ILogicalResourceIdentCacheClear any thread-local cache maps (probably because a transaction was rolled back)- Specified by:
clearLocalMapsin interfaceILogicalResourceIdentCache
-
-