Package org.cache2k.operation
Interface CacheInfo
-
- All Known Subinterfaces:
CacheControl
public interface CacheInfo
Information of a cache for introspection at runtime, for generic monitoring and management proposes. Additional information is available viaCacheStatistics
if statistics are enabled.It is intentionally that there is no way to retrieve the original configuration after creation.
- Author:
- Jens Wilke
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getCapacityLimit()
EithergetMaximumWeight()
orgetEntryCapacity()
depending on whether a weigher is present or not.@Nullable Instant
getClearedTime()
Time of the most recentCache.clear()
operation.Instant
getCreatedTime()
Time when the cache was created.long
getEntryCapacity()
The configured maximum number of entries in the cache.long
getExpiryAfterWriteTicks()
ConfiguredCache2kBuilder.expireAfterWrite(Duration)
orLong.MAX_VALUE
if no expiry.String
getImplementation()
Descriptor of cache implementation in use.CacheType<?>
getKeyType()
Type of the cache key.String
getManagerName()
long
getMaximumWeight()
Configured maximum weight or -1.String
getName()
long
getSize()
The current number of entries within the cache, starting with 0.TimeReference
getTimeReference()
Effective time referencelong
getTotalWeight()
Total weight of all entries in the cache.CacheType<?>
getValueType()
Type of the cache value.boolean
isLoaderPresent()
A loader is configured.boolean
isStatisticsEnabled()
This cache supports statistics.boolean
isWeigherPresent()
A weigher is configured.static CacheInfo
of(Cache<?,?> cache)
Request an instance for the given cache.
-
-
-
Method Detail
-
getName
String getName()
-
getManagerName
String getManagerName()
-
getKeyType
CacheType<?> getKeyType()
Type of the cache key.
-
getValueType
CacheType<?> getValueType()
Type of the cache value.
-
getSize
long getSize()
The current number of entries within the cache, starting with 0. This value is an estimate, when iterating the entries the cache will always return less or an identical number of entries.Expired entries may stay in the cache
Cache2kBuilder.keepDataAfterExpired(boolean)
. These entries will be counted, but will not be returned by the iterator or apeek
operation
-
getEntryCapacity
long getEntryCapacity()
The configured maximum number of entries in the cache.
-
getMaximumWeight
long getMaximumWeight()
Configured maximum weight or -1.- See Also:
Weigher
,Cache2kBuilder.maximumWeight(long)
-
getTotalWeight
long getTotalWeight()
Total weight of all entries in the cache.- See Also:
Weigher
,Cache2kBuilder.maximumWeight(long)
-
getCapacityLimit
long getCapacityLimit()
EithergetMaximumWeight()
orgetEntryCapacity()
depending on whether a weigher is present or not.- See Also:
Weigher
-
getImplementation
String getImplementation()
Descriptor of cache implementation in use. Either a class name or multiple class names.
-
isLoaderPresent
boolean isLoaderPresent()
A loader is configured. This can be used to determine, whether it makes sense to send the report/monitor the loader metrics.
-
isWeigherPresent
boolean isWeigherPresent()
A weigher is configured. This can be used to determine, whether it makes sense to send the report/monitor the weigher metrics.
-
isStatisticsEnabled
boolean isStatisticsEnabled()
This cache supports statistics.
-
getCreatedTime
Instant getCreatedTime()
Time when the cache was created.We use the old type
Date
and notInstant
here in order to make this interface usable for JMX directly, which does not supportInstant
.
-
getClearedTime
@Nullable @Nullable Instant getClearedTime()
Time of the most recentCache.clear()
operation.
-
getExpiryAfterWriteTicks
long getExpiryAfterWriteTicks()
ConfiguredCache2kBuilder.expireAfterWrite(Duration)
orLong.MAX_VALUE
if no expiry.- Since:
- 2.6
-
getTimeReference
TimeReference getTimeReference()
Effective time reference- Since:
- 2.6
-
-