public static final class CacheUsageView.ImmutableCacheUsageView extends Object implements CacheUsage
CacheUsage.DirPartition, CacheUsage.FilePartition, CacheUsage.PartitionDescriptor<T>, CacheUsage.ScopePartition
CacheUsageView.ImmutableCacheUsageView
Constructor and Description |
---|
ImmutableCacheUsageView(long used,
long available,
long capacity)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
long |
available()
Bytes that are available for caching.
|
long |
capacity()
Total capacity of the cache.
|
boolean |
equals(Object o) |
int |
hashCode() |
Optional<CacheUsage> |
partitionedBy(CacheUsage.PartitionDescriptor<?> partition)
Gets a finer-grained view of cache usage.
|
CacheUsageView |
snapshot()
Creates an immutable snapshot of the current cache usage.
|
String |
toString() |
long |
used()
Bytes currently used by the cache.
|
public ImmutableCacheUsageView(long used, long available, long capacity)
used
- usedavailable
- availablecapacity
- capacitypublic long used()
CacheUsageView
used
in interface CacheUsageView
public long available()
CacheUsageView
available
in interface CacheUsageView
public long capacity()
CacheUsageView
capacity
in interface CacheUsageView
public CacheUsageView snapshot()
CacheUsage
snapshot
in interface CacheUsage
public Optional<CacheUsage> partitionedBy(CacheUsage.PartitionDescriptor<?> partition)
CacheUsage
cacheManager.getUsage()
.flatMap(usage -> usage.partitionedBy(PartitionDescriptor.file(fileId))
.map(CacheUsage::used)
.orElse(0)
partitionedBy
in interface CacheUsage
partition
- how to partition the cacheCopyright © 2023. All Rights Reserved.