Class DefaultKeyValueStore

java.lang.Object
io.fluxcapacitor.javaclient.persisting.keyvalue.DefaultKeyValueStore
All Implemented Interfaces:
KeyValueStore

public class DefaultKeyValueStore extends Object implements KeyValueStore
The default implementation of the KeyValueStore interface that provides operations for storing, retrieving, and deleting key-value pairs using a KeyValueClient and a Serializer. This class handles serialization and deserialization of values and ensures that operations conform to the guarantees provided by the client.
  • Constructor Details

    • DefaultKeyValueStore

      public DefaultKeyValueStore()
  • Method Details

    • store

      public void store(String key, Object value, Guarantee guarantee)
      Description copied from interface: KeyValueStore
      Stores a value under the given key with the specified delivery guarantee.
      Specified by:
      store in interface KeyValueStore
      Parameters:
      key - the key to store the value under
      value - the value to store
      guarantee - the delivery guarantee (e.g., SENT, STORED)
    • storeIfAbsent

      public boolean storeIfAbsent(String key, Object value)
      Description copied from interface: KeyValueStore
      Stores a value only if there is no existing value for the specified key.
      Specified by:
      storeIfAbsent in interface KeyValueStore
      Parameters:
      key - the key to store the value under
      value - the value to store
      Returns:
      true if the value was stored, false if the key already had a value
    • get

      public <R> R get(String key)
      Description copied from interface: KeyValueStore
      Retrieves the value associated with the given key.
      Specified by:
      get in interface KeyValueStore
      Type Parameters:
      R - the expected result type
      Parameters:
      key - the key to retrieve
      Returns:
      the stored value, or null if not found
    • delete

      public void delete(String key)
      Description copied from interface: KeyValueStore
      Removes the value associated with the given key.
      Specified by:
      delete in interface KeyValueStore
      Parameters:
      key - the key to delete