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 | 
|---|---|
long | 
addAndGet(String key,
         long delta)
Atomically adds the delta to the value associated to the key, interpreted as a long represented as a string. 
 | 
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. 
 | 
boolean | 
compareAndSet(String key,
             byte[] expected,
             byte[] value,
             long ttl)
Atomically sets the value associated to the key to the given value, with the given TTL, if the current value is
 the expected value. 
 | 
boolean | 
compareAndSet(String key,
             String expected,
             String value)
Atomically sets the value associated to the key to the given value if the current value is the expected value. 
 | 
boolean | 
compareAndSet(String key,
             String expected,
             String value,
             long ttl)
Atomically sets the value associated to the key to the given value, with the given TTL, if the current value is
 the expected value. 
 | 
Map<String,byte[]> | 
get(Collection<String> keys)
Retrieves the key/value map associated with the keys. 
 | 
byte[] | 
get(String key)
Retrieves the value associated to the key. 
 | 
Long | 
getLong(String key)
Retrieves the value associated to the key. 
 | 
Map<String,Long> | 
getLongs(Collection<String> keys)
Retrieves the key/value map associated with the  keys. 
 | 
String | 
getString(String key)
Retrieves the value associated to the key. 
 | 
Map<String,String> | 
getStrings(Collection<String> keys)
Retrieves the key/value map associated with the  keys. 
 | 
void | 
put(String key,
   byte[] value)
Sets the value associated to the key. 
 | 
void | 
put(String key,
   byte[] value,
   long ttl)
Sets the value associated to the key, and a TTL. 
 | 
void | 
put(String key,
   Long value)
Sets the value associated to the key. 
 | 
void | 
put(String key,
   Long value,
   long ttl)
Sets the value associated to the key. 
 | 
void | 
put(String key,
   String value)
Sets the value associated to the key. 
 | 
void | 
put(String key,
   String value,
   long ttl)
Sets the value associated to the key, and a TTL. 
 | 
boolean | 
setTTL(String key,
      long ttl)
Sets the TTL for an existing key. 
 | 
void put(String key, byte[] value)
key - the keyvalue - the value, which may be nullvoid put(String key, String value)
key - the keyvalue - the value, which may be nullvoid put(String key, Long value)
key - the keyvalue - the value, which may be nullvoid put(String key, byte[] value, long ttl)
key - the keyvalue - the value, which may be nullttl - the TTL, in seconds (0 for infinite)void put(String key, String value, long ttl)
key - the keyvalue - the value, which may be nullttl - the TTL, in seconds (0 for infinite)void put(String key, Long value, long ttl)
key - the keyvalue - the value, which may be nullttl - the TTL, in seconds (0 for infinite)boolean setTTL(String key, long ttl)
key - the keyttl - the TTL, in seconds (0 for infinite)true if the TTL has been set, or false if the key does not existbyte[] get(String key)
key - the keynull if there is no valueString getString(String key)
key - the keynull if there is no valueIllegalArgumentException - if the value cannot be returned as a StringLong getLong(String key) throws NumberFormatException
key - the keynull if there is no valueNumberFormatException - if the value cannot be returned as a LongMap<String,byte[]> get(Collection<String> keys)
keys - the keysMap<String,String> getStrings(Collection<String> keys)
keys - the keysIllegalArgumentException - if one of the values cannot be returned as a StringMap<String,Long> getLongs(Collection<String> keys) throws NumberFormatException
keys - the keysNumberFormatException - if one of the values cannot be returned as a Longboolean 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 nullvalue - the updated value, which may be nulltrue if the value was updated, or false if not (the expected value was not found)boolean compareAndSet(String key, byte[] expected, byte[] value, long ttl)
Note value comparison is done by value and not by reference.
key - the keyexpected - the expected value, which may be nullvalue - the updated value, which may be nullttl - the TTL, in seconds (0 for infinite)true if the value was updated, or false if not (the expected value was not found)boolean compareAndSet(String key, String expected, String value)
Note value comparison is done by value and not by reference.
key - the keyexpected - the expected value, which may be nullvalue - the updated value, which may be nulltrue if the value was updated, or false if not (the expected value was not found)boolean compareAndSet(String key, String expected, String value, long ttl)
Note value comparison is done by value and not by reference.
key - the keyexpected - the expected value, which may be nullvalue - the updated value, which may be nullttl - the TTL, in seconds (0 for infinite)true if the value was updated, or false if not (the expected value was not found)long addAndGet(String key, long delta)
 If the value does not exist (if get(java.lang.String) would return null), it is interpreted as 0.
key - the keydelta - the delta to addNumberFormatException - if the existing value cannot be interpreted as a longCopyright © 2019 Nuxeo. All rights reserved.