Interface KeyValueStore
- All Superinterfaces:
Namespaced<KeyValueStore>
- All Known Implementing Classes:
DefaultKeyValueStore
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.
Writes return futures and do not block. Use an explicit Guarantee.STORED and await its future when
another operation depends on durable storage. Active tracking batches await registered write completions.
Note: This API is considered legacy in the Fluxzero Runtime. 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 TypeMethodDescriptiondefault CompletableFuture<Void> Removes the value associated with the given key.Removes a value asynchronously with the specified delivery guarantee.default KeyValueStoreforNamespace(String namespace) Returns this key-value store scoped to the requested namespace.<R> RRetrieves the value associated with the given key.default CompletableFuture<Void> Stores a value under the given key with the defaultGuarantee.DEFAULTdelivery guarantee.Stores a value under the given key with the specified delivery guarantee.storeIfAbsent(String key, Object value) Stores a value only if there is no existing value for the specified key.Methods inherited from interface Namespaced
forApplicationNamespace, forDefaultNamespace
-
Method Details
-
forNamespace
Returns this key-value store scoped to the requested namespace.- Specified by:
forNamespacein interfaceNamespaced<KeyValueStore>- Parameters:
namespace- the namespace to which the returned store is scoped- Returns:
- the key-value store associated with the specified namespace
-
store
Stores a value under the given key with the defaultGuarantee.DEFAULTdelivery guarantee.- Parameters:
key- the key to store the value undervalue- the value to store- Returns:
- delivery completion according to the application default
-
store
Stores a value under the given key with the specified delivery guarantee.- Parameters:
key- the key to store the value undervalue- the value to storeguarantee- the delivery guarantee (DEFAULT, NONE, SENT, or STORED)- Returns:
- completion according to the selected guarantee
-
storeIfAbsent
Stores a value only if there is no existing value for the specified key. This always requests a stored result; the application delivery default does not weaken the conditional operation.- Parameters:
key- the key to store the value undervalue- the value to store- Returns:
- a future with
trueif the value was stored,falseif the key already had a value
-
get
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
nullif not found
-
delete
Removes the value associated with the given key.- Parameters:
key- the key to delete- Returns:
- completion according to the application default
-
delete
Removes a value asynchronously with the specified delivery guarantee.- Parameters:
key- the key to deleteguarantee- concrete guarantee or DEFAULT- Returns:
- completion according to the selected guarantee
-