Package org.cache2k.operation
Interface CacheInfo
-
- All Known Subinterfaces:
CacheControl
public interface CacheInfoInformation of a cache for introspection at runtime, for generic monitoring and management proposes. Additional information is available viaCacheStatisticsif 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 longgetCapacityLimit()EithergetMaximumWeight()orgetEntryCapacity()depending on whether a weigher is present or not.@Nullable InstantgetClearedTime()Time of the most recentCache.clear()operation.InstantgetCreatedTime()Time when the cache was created.longgetEntryCapacity()The configured maximum number of entries in the cache.longgetExpiryAfterWriteTicks()ConfiguredCache2kBuilder.expireAfterWrite(Duration)orLong.MAX_VALUEif no expiry.StringgetImplementation()Descriptor of cache implementation in use.CacheType<?>getKeyType()Type of the cache key.StringgetManagerName()longgetMaximumWeight()Configured maximum weight or -1.StringgetName()longgetSize()The current number of entries within the cache, starting with 0.TimeReferencegetTimeReference()Effective time referencelonggetTotalWeight()Total weight of all entries in the cache.CacheType<?>getValueType()Type of the cache value.booleanisLoaderPresent()A loader is configured.booleanisStatisticsEnabled()This cache supports statistics.booleanisWeigherPresent()A weigher is configured.static CacheInfoof(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 apeekoperation
-
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
Dateand notInstanthere 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_VALUEif no expiry.- Since:
- 2.6
-
getTimeReference
TimeReference getTimeReference()
Effective time reference- Since:
- 2.6
-
-