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 via CacheStatistics if statistics are enabled.

    It is intentionally that there is no way to retrieve the original configuration after creation.

    Author:
    Jens Wilke
    • Method Detail

      • of

        static CacheInfo of​(Cache<?,​?> cache)
        Request an instance for the given cache.
      • 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 a peek operation

      • getEntryCapacity

        long getEntryCapacity()
        The configured maximum number of entries in the cache.
      • 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 not Instant here in order to make this interface usable for JMX directly, which does not support Instant.