Class NoStrictCacheSizeAllocator
- java.lang.Object
-
- org.apache.pulsar.sql.presto.util.NoStrictCacheSizeAllocator
-
- All Implemented Interfaces:
CacheSizeAllocator
public class NoStrictCacheSizeAllocator extends java.lang.Object implements CacheSizeAllocator
Cache size allocator.
-
-
Constructor Summary
Constructors Constructor Description NoStrictCacheSizeAllocator(long maxCacheSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidallocate(long size)This operation will cost available cache size.longgetAvailableCacheSize()Get available cache size.voidrelease(long size)This method used to release used cache size and add available cache size.
-
-
-
Method Detail
-
getAvailableCacheSize
public long getAvailableCacheSize()
Description copied from interface:CacheSizeAllocatorGet available cache size.- Specified by:
getAvailableCacheSizein interfaceCacheSizeAllocator- 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:
allocatein interfaceCacheSizeAllocator- 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:
releasein interfaceCacheSizeAllocator- Parameters:
size- release size
-
-