Class DefaultKeyValueStore
java.lang.Object
io.fluxzero.sdk.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 TypeMethodDescriptionvoidRemoves the value associated with the given key.<R> RRetrieves the value associated with the given key.voidStores a value under the given key with the specified delivery guarantee.booleanstoreIfAbsent(String key, Object value) Stores a value only if there is no existing value for the specified key.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface KeyValueStore
store
-
Constructor Details
-
DefaultKeyValueStore
public DefaultKeyValueStore()
-
-
Method Details
-
store
Description copied from interface:KeyValueStoreStores a value under the given key with the specified delivery guarantee.- Specified by:
storein 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:KeyValueStoreStores a value only if there is no existing value for the specified key.- Specified by:
storeIfAbsentin interfaceKeyValueStore- Parameters:
key- the key to store the value undervalue- the value to store- Returns:
trueif the value was stored,falseif the key already had a value
-
get
Description copied from interface:KeyValueStoreRetrieves the value associated with the given key.- Specified by:
getin interfaceKeyValueStore- Type Parameters:
R- the expected result type- Parameters:
key- the key to retrieve- Returns:
- the stored value, or
nullif not found
-
delete
Description copied from interface:KeyValueStoreRemoves the value associated with the given key.- Specified by:
deletein interfaceKeyValueStore- Parameters:
key- the key to delete
-