public interface KeyValueStore
This is the interface for a Key/Value store, which stores simple values associated to keys.
A Key/Value store is thread-safe.
Modifier and Type | Method and Description |
---|---|
boolean |
compareAndSet(String key,
byte[] expected,
byte[] value)
Atomically sets the value associated to the key to the given value if the current value is the expected value.
|
byte[] |
get(String key)
Retrieves the value associated to the key.
|
void |
put(String key,
byte[] value)
Sets the value associated to the key.
|
void put(String key, byte[] value)
key
- the keyvalue
- the value, which may be null
byte[] get(String key)
key
- the keynull
if there is no valueboolean compareAndSet(String key, byte[] expected, byte[] value)
Note value comparison is done by value and not by reference.
key
- the keyexpected
- the expected value, which may be null
value
- the updated value, which may be null
true
if the value was updated, or false
if not (the expected value was not found)Copyright © 2017 Nuxeo. All rights reserved.