Class UnboundedLocalCache.UnboundedPolicy<K,​V>

  • All Implemented Interfaces:
    Policy<K,​V>
    Enclosing class:
    UnboundedLocalCache<K,​V>

    static final class UnboundedLocalCache.UnboundedPolicy<K,​V>
    extends java.lang.Object
    implements Policy<K,​V>
    An eviction policy that supports no boundings.
    • Field Detail

      • isRecordingStats

        private final boolean isRecordingStats
    • Constructor Detail

      • UnboundedPolicy

        UnboundedPolicy​(boolean isRecordingStats)
    • Method Detail

      • isRecordingStats

        public boolean isRecordingStats()
        Description copied from interface: Policy
        Returns whether the cache statistics are being accumulated.
        Specified by:
        isRecordingStats in interface Policy<K,​V>
        Returns:
        if cache statistics are being recorded
      • eviction

        public java.util.Optional<Policy.Eviction<K,​V>> eviction()
        Description copied from interface: Policy
        Returns access to perform operations based on the maximum size or maximum weight eviction policy. If the cache was not constructed with a size-based bound or the implementation does not support these operations, an empty Optional is returned.
        Specified by:
        eviction in interface Policy<K,​V>
        Returns:
        access to low-level operations for this cache if an eviction policy is used
      • expireAfterAccess

        public java.util.Optional<Policy.Expiration<K,​V>> expireAfterAccess()
        Description copied from interface: Policy
        Returns access to perform operations based on the time-to-idle expiration policy. This policy determines that an entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, the most recent replacement of its value, or its last access. Access time is reset by all cache read and write operations (including Cache.asMap().get(Object) and Cache.asMap().put(K, V)), but not by operations on the collection-views of Cache.asMap().

        If the cache was not constructed with access-based expiration or the implementation does not support these operations, an empty Optional is returned.

        Specified by:
        expireAfterAccess in interface Policy<K,​V>
        Returns:
        access to low-level operations for this cache if a time-to-idle expiration policy is used
      • expireAfterWrite

        public java.util.Optional<Policy.Expiration<K,​V>> expireAfterWrite()
        Description copied from interface: Policy
        Returns access to perform operations based on the time-to-live expiration policy. This policy determines that an entry should be automatically removed from the cache once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value.

        If the cache was not constructed with write-based expiration or the implementation does not support these operations, an empty Optional is returned.

        Specified by:
        expireAfterWrite in interface Policy<K,​V>
        Returns:
        access to low-level operations for this cache if a time-to-live expiration policy is used
      • refreshAfterWrite

        public java.util.Optional<Policy.Expiration<K,​V>> refreshAfterWrite()
        Description copied from interface: Policy
        Returns access to perform operations based on the time-to-live refresh policy. This policy determines that an entry should be automatically reloaded once a fixed duration has elapsed after the entry's creation, or the most recent replacement of its value.

        If the cache was not constructed with write-based refresh or the implementation does not support these operations, an empty Optional is returned.

        Specified by:
        refreshAfterWrite in interface Policy<K,​V>
        Returns:
        access to low-level operations for this cache if a time-to-live refresh policy is used