Class LookupCacheManager


  • @Internal
    public class LookupCacheManager
    extends Object
    Managing shared caches across different subtasks.

    In order to reduce the memory usage of cache, different subtasks of the same lookup join runner will share the same cache instance. Caches are managed by the identifier of the lookup table for which it is serving.

    • Method Detail

      • registerCacheIfAbsent

        public org.apache.flink.table.connector.source.lookup.cache.LookupCache registerCacheIfAbsent​(String cacheIdentifier,
                                                                                                      org.apache.flink.table.connector.source.lookup.cache.LookupCache cache)
        Register a cache instance with identifier to the manager.

        If the cache with the given identifier is already registered in the manager, this method will return the registered one, otherwise this method will register the given cache into the manager then return.

        Parameters:
        cacheIdentifier - identifier of the cache
        cache - instance of cache trying to register
        Returns:
        instance of the shared cache
      • unregisterCache

        public void unregisterCache​(String cacheIdentifier)
        Release the cache with the given identifier from the manager.

        The manager will track a reference count of managed caches, and will close the cache if the reference count reaches 0.

      • keepCacheOnRelease

        public static void keepCacheOnRelease​(boolean toKeep)
      • checkAllReleased

        public void checkAllReleased()
      • clear

        public void clear()