Class CommonTokenValuesCacheImpl

  • All Implemented Interfaces:
    ICommonTokenValuesCache

    public class CommonTokenValuesCacheImpl
    extends java.lang.Object
    implements ICommonTokenValuesCache
    Implementation of a cache used for lookups of entities related to local and external resource references
    • Constructor Summary

      Constructors 
      Constructor Description
      CommonTokenValuesCacheImpl​(int codeSystemCacheSize, int tokenValueCacheSize, int canonicalCacheSize)
      Public constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addCanonicalValue​(java.lang.String url, int id)
      Add the url-id mapping to the local cache
      void addCodeSystem​(java.lang.String codeSystem, int id)
      Add the id to the local cache
      void addTokenValue​(CommonTokenValue key, long id)
      Add the CommonTokenValue and id to the local cache
      void clearLocalMaps()
      Clear any thread-local cache maps (probably because a transaction was rolled back)
      java.lang.Integer getCanonicalId​(java.lang.String canonicalValue)
      Get the cached database id for the given canonical url
      java.lang.Integer getCodeSystemId​(java.lang.String codeSystem)
      Look up the id of the named codeSystem
      java.lang.Long getCommonTokenValueId​(java.lang.String codeSystem, java.lang.String tokenValue)
      Get the database common_token_value_id for the given code system and token value.
      void prefillCodeSystems​(java.util.Map<java.lang.String,​java.lang.Integer> codeSystems)
      Add the contents of the given codeSystems map to the shared cache.
      void reset()
      Clear the thread-local and shared caches (for test purposes)
      void resolveCanonicalValues​(java.util.Collection<ResourceProfileRec> profileValues, java.util.List<ResourceProfileRec> misses)
      Look up the ids for the common canonical values in the cache
      void resolveCodeSystems​(java.util.Collection<ResourceTokenValueRec> tokenValues, java.util.List<ResourceTokenValueRec> misses)
      Lookup all the database values we have cached for the code-system names in the given collection.
      java.util.Set<java.lang.Long> resolveCommonTokenValueIds​(java.util.Collection<CommonTokenValue> tokenValues, java.util.Set<CommonTokenValue> misses)
      Get the database common_token_value_ids for the given list of token values.
      void resolveTokenValues​(java.util.Collection<ResourceTokenValueRec> tokenValues, java.util.List<ResourceTokenValueRec> misses)
      Look up the ids for the common token values.
      void updateSharedMaps()
      Called after a transaction commit() to transfer all the staged (thread-local) data over to the shared LRU cache.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CommonTokenValuesCacheImpl

        public CommonTokenValuesCacheImpl​(int codeSystemCacheSize,
                                          int tokenValueCacheSize,
                                          int canonicalCacheSize)
        Public constructor
        Parameters:
        codeSystemCacheSize -
        tokenValueCacheSize -
        canonicalCacheSize -