Class BundledCacheLimitPolicy
java.lang.Object
org.apache.flink.state.forst.fs.cache.BundledCacheLimitPolicy
- All Implemented Interfaces:
CacheLimitPolicy
A bundled cache limit policy, any two cache policies can be combined.
-
Constructor Summary
Constructors -
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.toString()longGet current used bytes.
-
Constructor Details
-
BundledCacheLimitPolicy
-
-
Method Details
-
directWriteInCache
public boolean directWriteInCache()Description copied from interface:CacheLimitPolicyWhether to support directly write in cache.- Specified by:
directWriteInCachein interfaceCacheLimitPolicy
-
isSafeToAdd
public boolean isSafeToAdd(long toAddSize) Description copied from interface:CacheLimitPolicyWhether the cache usage is safe to add.- Specified by:
isSafeToAddin interfaceCacheLimitPolicy- Returns:
- false if the toAddSize is larger than max available capacity, true otherwise.
-
isOverflow
public boolean isOverflow(long toAddSize, boolean hasFile) Description copied from interface:CacheLimitPolicyWhether the cache usage is exceeded the upperbound.- Specified by:
isOverflowin interfaceCacheLimitPolicy- 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
public void acquire(long toAddSize) Description copied from interface:CacheLimitPolicyAcquire cache.- Specified by:
acquirein interfaceCacheLimitPolicy
-
release
public void release(long toReleaseSize) Description copied from interface:CacheLimitPolicyRelease cache.- Specified by:
releasein interfaceCacheLimitPolicy
-
usedBytes
public long usedBytes()Description copied from interface:CacheLimitPolicyGet current used bytes.- Specified by:
usedBytesin interfaceCacheLimitPolicy- Returns:
- cache bytes.
-
registerCustomizedMetrics
public void registerCustomizedMetrics(String prefix, org.apache.flink.metrics.MetricGroup metricGroup) Description copied from interface:CacheLimitPolicyRegister customized metrics.- Specified by:
registerCustomizedMetricsin interfaceCacheLimitPolicy
-
toString
-