Class NoStrictCacheSizeAllocator

java.lang.Object
org.apache.pulsar.sql.presto.util.NoStrictCacheSizeAllocator
All Implemented Interfaces:
CacheSizeAllocator

public class NoStrictCacheSizeAllocator extends Object implements CacheSizeAllocator
Cache size allocator.
  • Constructor Details

    • NoStrictCacheSizeAllocator

      public NoStrictCacheSizeAllocator(long maxCacheSize)
  • Method Details

    • getAvailableCacheSize

      public long getAvailableCacheSize()
      Description copied from interface: CacheSizeAllocator
      Get available cache size.
      Specified by:
      getAvailableCacheSize in interface CacheSizeAllocator
      Returns:
      available cache size
    • allocate

      public void allocate(long size)
      This operation will cost available cache size. if the request size exceed the available size, it's should be allowed, because maybe one entry size exceed the size and the query must be finished, the available size will become invalid.
      Specified by:
      allocate in interface CacheSizeAllocator
      Parameters:
      size - allocate size
    • release

      public void release(long size)
      This method used to release used cache size and add available cache size. in normal case, the available size shouldn't exceed max cache size.
      Specified by:
      release in interface CacheSizeAllocator
      Parameters:
      size - release size