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 void
addRecord(LogicalResourceIdentKey key, long id)
Add the LogicalResourceIdent key and id to the local cachevoid
clearLocalMaps()
Clear any thread-local cache maps (probably because a transaction was rolled back)java.lang.Long
getLogicalResourceId(int resourceTypeId, java.lang.String logicalId)
Get the database logical_resourc_id for the given resource type and logicalIdvoid
reset()
Clear the thread-local and shared caches (for test purposes)void
resolveReferenceValues(java.util.Collection<ResourceReferenceValueRec> values, java.util.List<ResourceReferenceValueRec> misses)
Lookup all the database values we have cached for the given collection.void
updateSharedMaps()
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:
updateSharedMaps
in interfaceILogicalResourceIdentCache
-
getLogicalResourceId
public java.lang.Long getLogicalResourceId(int resourceTypeId, java.lang.String logicalId)
Description copied from interface:ILogicalResourceIdentCache
Get the database logical_resourc_id for the given resource type and logicalId- Specified by:
getLogicalResourceId
in interfaceILogicalResourceIdentCache
- Returns:
-
resolveReferenceValues
public void resolveReferenceValues(java.util.Collection<ResourceReferenceValueRec> values, java.util.List<ResourceReferenceValueRec> misses)
Description copied from interface:ILogicalResourceIdentCache
Lookup 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:
resolveReferenceValues
in interfaceILogicalResourceIdentCache
misses
- the objects we couldn't find in the cache
-
addRecord
public void addRecord(LogicalResourceIdentKey key, long id)
Description copied from interface:ILogicalResourceIdentCache
Add the LogicalResourceIdent key and id to the local cache- Specified by:
addRecord
in interfaceILogicalResourceIdentCache
-
reset
public void reset()
Description copied from interface:ILogicalResourceIdentCache
Clear the thread-local and shared caches (for test purposes)- Specified by:
reset
in interfaceILogicalResourceIdentCache
-
clearLocalMaps
public void clearLocalMaps()
Description copied from interface:ILogicalResourceIdentCache
Clear any thread-local cache maps (probably because a transaction was rolled back)- Specified by:
clearLocalMaps
in interfaceILogicalResourceIdentCache
-
-