Interface CacheLimitPolicy
-
- All Known Implementing Classes:
BundledCacheLimitPolicy,SizeBasedCacheLimitPolicy,SpaceBasedCacheLimitPolicy
public interface CacheLimitPolicyCache limit policy.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidacquire(long toAddSize)Acquire cache.booleandirectWriteInCache()Whether 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.longusedBytes()Get current used bytes.
-
-
-
Method Detail
-
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
void registerCustomizedMetrics(String prefix, org.apache.flink.metrics.MetricGroup metricGroup)
Register customized metrics.- Parameters:
prefix-metricGroup-
-
-