Interface CacheLimitPolicy
- All Known Implementing Classes:
BundledCacheLimitPolicy,SizeBasedCacheLimitPolicy,SpaceBasedCacheLimitPolicy
public interface CacheLimitPolicy
Cache limit policy.
-
Method Summary
Modifier and TypeMethodDescriptionvoidacquire(long toAddSize) Acquire cache.booleanWhether to support directly write in cache.booleanisOverflow(long toAddSize, boolean hasFile) Whether the cache usage is exceeded the upperbound.booleanisSafeToAdd(long toAddSize) Whether the cache usage is safe to add.voidregisterCustomizedMetrics(String prefix, org.apache.flink.metrics.MetricGroup metricGroup) Register customized metrics.voidrelease(long toReleaseSize) Release cache.longGet current used bytes.
-
Method Details
-
directWriteInCache
boolean directWriteInCache()Whether to support directly write in cache. -
isSafeToAdd
boolean isSafeToAdd(long toAddSize) Whether the cache usage is safe to add.- Parameters:
toAddSize-- Returns:
- false if the toAddSize is larger than max available capacity, true otherwise.
-
isOverflow
boolean isOverflow(long toAddSize, boolean hasFile) Whether the cache usage is exceeded the upperbound.- Parameters:
toAddSize- the size about to add.hasFile- whether the file is already in cache.- Returns:
- true if the cache usage is overflow, false otherwise.
-
acquire
void acquire(long toAddSize) Acquire cache.- Parameters:
toAddSize-
-
release
void release(long toReleaseSize) Release cache.- Parameters:
toReleaseSize-
-
usedBytes
long usedBytes()Get current used bytes.- Returns:
- cache bytes.
-
registerCustomizedMetrics
Register customized metrics.- Parameters:
prefix-metricGroup-
-