Class ValidTimestampPolicy

  • All Implemented Interfaces:
    RetentionPolicy

    public class ValidTimestampPolicy
    extends Object
    implements RetentionPolicy
    The given key is overloaded to have the timestamp information. This just looks at that and parses it to make the decision.

    Created by Jeff Gaynor
    on 7/12/11 at 12:26 PM

    • Field Detail

      • maxTimeout

        protected long maxTimeout
    • Constructor Detail

      • ValidTimestampPolicy

        public ValidTimestampPolicy​(long maxTimeout)
      • ValidTimestampPolicy

        public ValidTimestampPolicy()
    • Method Detail

      • applies

        public boolean applies()
        Description copied from interface: RetentionPolicy
        If this applies to the current cache. While this is true, the RetentionPolicy.retain(Object, Object) method will be applied to each element of the cache. When false, this policy will be skipped.
        E.g. for a cache that limits the number of cached items, there is no reason to check every item in the cache directly if the cache size is below a certain threshold.
        Specified by:
        applies in interface RetentionPolicy
        Returns:
      • getMap

        public Cache getMap()
        This returns null, since the retention decision requires only the key of the entry, not the entire store (cf. MaxSizePolicy which does have to think about the store size.) No reason to have setters or getters.
        Specified by:
        getMap in interface RetentionPolicy
        Returns: