Interface KeyValueClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
InMemoryKeyValueStore
,WebsocketKeyValueClient
Represents a service to store and retrieve a piece of serialized data by key.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
default CompletableFuture
<Void> deleteValue
(String key) Deletes the value associated with the given key.deleteValue
(String key, Guarantee guarantee) Deletes the value associated with the given key.Data
<byte[]> Returns theData
object associated with the given key.Adds or replaces the given value in the key value store.putValueIfAbsent
(String key, Data<byte[]> value) Adds the given value in the key value store if the key is not already mapped to a value.
-
Method Details
-
putValue
Adds or replaces the given value in the key value store.- Parameters:
key
- The key associated with this valuevalue
- The value to storeguarantee
- The guarantee for storing- Returns:
- a handle that enables clients to wait until the value was sent or stored depending on the guarantee
-
putValueIfAbsent
Adds the given value in the key value store if the key is not already mapped to a value.- Parameters:
key
- The key associated with this valuevalue
- The value to store- Returns:
- a handle that enables clients to wait until the value was sent or stored depending on the guarantee
-
getValue
Returns theData
object associated with the given key. Returnsnull
if there is no associated value.- Parameters:
key
- The key associated with the value- Returns:
- the value for the given key or null
-
deleteValue
Deletes the value associated with the given key.- Parameters:
key
- The key associated with this value- Returns:
- a handle that enables clients to wait until the command was safely sent to the store
-
deleteValue
Deletes the value associated with the given key.- Parameters:
key
- The key associated with this value- Returns:
- a handle that enables clients to wait until the command was safely sent to the store
-
close
void close()- Specified by:
close
in interfaceAutoCloseable
-