Class ExpiryCache<K>

java.lang.Object
org.jgroups.util.ExpiryCache<K>

public class ExpiryCache<K> extends Object
Cache which maintains timestamps for keys, and methods to remove/replace expired keys. Compared to AgeOutCache, ExpiryCache doesn't require a timer task to run
Version:
3.3
  • Field Details

  • Constructor Details

    • ExpiryCache

      public ExpiryCache(long timeout)
      Creates a new instance
      Parameters:
      timeout - Timeout in ms
  • Method Details

    • getTimeout

      public long getTimeout()
    • setTimeout

      public void setTimeout(long timeout)
    • addIfAbsentOrExpired

      public boolean addIfAbsentOrExpired(K key)
    • contains

      public boolean contains(K key)
    • hasExpired

      public boolean hasExpired(K key)
    • remove

      public void remove(K key)
    • removeAll

      public void removeAll(Collection<K> keys)
    • removeExpiredElements

      public int removeExpiredElements()
    • clear

      public void clear()
    • size

      public int size()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hasExpired

      protected boolean hasExpired(long val, long current_time)