Class 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 Object
    implements INameIdCache<T>
    • Constructor Detail

      • NameIdCache

        public NameIdCache()
        Public constructor
    • 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 interface INameIdCache<T>
      • getId

        public T getId​(String key)
        Description copied from interface: INameIdCache
        Get the resource type identifier for the given resourceType name
        Specified by:
        getId in interface INameIdCache<T>
        Returns:
      • addEntry

        public void addEntry​(String resourceType,
                             T resourceTypeId)
        Description copied from interface: INameIdCache
        Add the resource type to the local cache
        Specified by:
        addEntry in interface INameIdCache<T>
      • reset

        public void reset()
        Description copied from interface: INameIdCache
        Clear both local shared caches - useful for unit tests
        Specified by:
        reset in interface INameIdCache<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 interface INameIdCache<T>
      • prefill

        public void prefill​(Map<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 interface INameIdCache<T>