Interface KeyValueClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
InMemoryKeyValueClient,WebsocketKeyValueClient
Represents a service to store and retrieve a piece of serialized data by key.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()deleteValue(String key) Deletes the value associated with the given key.Data<byte[]>Returns theDataobject 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 theDataobject associated with the given key. Returnsnullif 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
-
close
void close()- Specified by:
closein interfaceAutoCloseable
-