Interface KeyValueStore

All Known Implementing Classes:
DefaultKeyValueStore

public interface KeyValueStore
A simple interface for storing, retrieving, and removing key-value pairs.

This interface provides basic persistence operations such as storing values (with optional guarantees), retrieving them by key, conditionally storing only if absent, and deleting by key.

Note: This API is considered legacy in the Flux Capacitor platform. It is recommended to use the more advanced and flexible DocumentStore instead, which supports structured querying, indexing, updates, and document lifecycle features.

This interface is still supported internally for backward compatibility and simple data use cases.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes the value associated with the given key.
    <R> R
    get(String key)
    Retrieves the value associated with the given key.
    default void
    store(String key, Object value)
    Stores a value under the given key with the default Guarantee.SENT delivery guarantee.
    void
    store(String key, Object value, Guarantee guarantee)
    Stores a value under the given key with the specified delivery guarantee.
    boolean
    Stores a value only if there is no existing value for the specified key.
  • Method Details

    • store

      default void store(String key, Object value)
      Stores a value under the given key with the default Guarantee.SENT delivery guarantee.
      Parameters:
      key - the key to store the value under
      value - the value to store
    • store

      void store(String key, Object value, Guarantee guarantee)
      Stores a value under the given key with the specified delivery guarantee.
      Parameters:
      key - the key to store the value under
      value - the value to store
      guarantee - the delivery guarantee (e.g., SENT, STORED)
    • storeIfAbsent

      boolean storeIfAbsent(String key, Object value)
      Stores a value only if there is no existing value for the specified key.
      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

      <R> R get(String key)
      Retrieves the value associated with the given key.
      Type Parameters:
      R - the expected result type
      Parameters:
      key - the key to retrieve
      Returns:
      the stored value, or null if not found
    • delete

      void delete(String key)
      Removes the value associated with the given key.
      Parameters:
      key - the key to delete