Class DefaultKeyValueStore
java.lang.Object
io.fluxcapacitor.javaclient.persisting.keyvalue.DefaultKeyValueStore
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Removes the value associated with the given key.<R> R
Retrieves the value associated with the given key.void
Stores a value under the given key with the specified delivery guarantee.boolean
storeIfAbsent
(String key, Object value) Stores a value only if there is no existing value for the specified key.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.javaclient.persisting.keyvalue.KeyValueStore
store
-
Constructor Details
-
DefaultKeyValueStore
public DefaultKeyValueStore()
-
-
Method Details
-
store
Description copied from interface:KeyValueStore
Stores a value under the given key with the specified delivery guarantee.- Specified by:
store
in interfaceKeyValueStore
- Parameters:
key
- the key to store the value undervalue
- the value to storeguarantee
- the delivery guarantee (e.g., SENT, STORED)
-
storeIfAbsent
Description copied from interface:KeyValueStore
Stores a value only if there is no existing value for the specified key.- Specified by:
storeIfAbsent
in interfaceKeyValueStore
- Parameters:
key
- the key to store the value undervalue
- the value to store- Returns:
true
if the value was stored,false
if the key already had a value
-
get
Description copied from interface:KeyValueStore
Retrieves the value associated with the given key.- Specified by:
get
in interfaceKeyValueStore
- Type Parameters:
R
- the expected result type- Parameters:
key
- the key to retrieve- Returns:
- the stored value, or
null
if not found
-
delete
Description copied from interface:KeyValueStore
Removes the value associated with the given key.- Specified by:
delete
in interfaceKeyValueStore
- Parameters:
key
- the key to delete
-