Class FifoCache<T>

java.lang.Object
software.amazon.awssdk.utils.cache.FifoCache<T>
Type Parameters:
T - value type

@ThreadSafe @SdkProtectedApi public final class FifoCache<T> extends Object
A bounded cache that has a FIFO eviction policy when the cache is full.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FifoCache(int maxSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    add(String key, T value)
    Adds an entry to the cache, evicting the earliest entry if necessary.
    get(String key)
    Returns the value of the given key; or null of no such entry exists.
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FifoCache

      public FifoCache(int maxSize)
      Parameters:
      maxSize - the maximum number of entries of the cache
  • Method Details

    • add

      public T add(String key, T value)
      Adds an entry to the cache, evicting the earliest entry if necessary.
    • get

      public T get(String key)
      Returns the value of the given key; or null of no such entry exists.
    • toString

      public String toString()
      Overrides:
      toString in class Object