Interface StorageContainer<T extends Serializable>

Type Parameters:
T - the types of data elements stored
All Known Subinterfaces:
ReplayCheckerStorageContainer
All Known Implementing Classes:
InMemoryReplayCheckerStorageContainer, InMemoryStorageContainer

public interface StorageContainer<T extends Serializable>
An interface defining generic methods for storage.
  • Method Summary

    Modifier and Type
    Method
    Description
    get(String id)
    Gets a data element from the container.
    Gets the "lifetime" of elements held in the container.
    Gets the name of the storage container.
    void
    put(String id, T data)
    Stores a data element in the container.
    void
    Removes an element from the container.
  • Method Details

    • getName

      @Nonnull String getName()
      Gets the name of the storage container.
      Returns:
      the storage container name
    • put

      void put(@Nonnull String id, @Nonnull T data)
      Stores a data element in the container.
      Parameters:
      id - the unique ID of the element
      data - the element to store
    • get

      @Nullable T get(@Nonnull String id)
      Gets a data element from the container.

      Note that an expired element will never be returned.

      Parameters:
      id - the unique ID of the element
      Returns:
      the element, or null if no matching element is available
    • remove

      void remove(String id)
      Removes an element from the container.
      Parameters:
      id - the unique ID of the element
    • getElementLifetime

      @Nullable Duration getElementLifetime()
      Gets the "lifetime" of elements held in the container. A null return value means "never expires".
      Returns:
      the lifetime, or null for eternal lifetime