public interface KeyValueStore extends Closeable
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the store.
|
String |
get(String key)
Get the value for a key from store.
|
default String |
getOrDefault(String key,
String defaultValue)
Get the value for a key from store or provide a default.
|
boolean |
isHealthy()
Get the health status of the store.
|
boolean |
isOpen()
Get the open / closed status of the store.
|
void |
open()
Open the store.
|
String |
put(String key,
String value)
Set a value for the key.
|
Map<String,String> |
putAll(Map<String,String> entries)
Set a multiple key/value pairs.
|
String |
remove(String key)
Remove a key from store.
|
default void |
replaceStore(String newStorePath)
Replaces key value store with a new key value store.
|
void open()
void close()
close
in interface AutoCloseable
close
in interface Closeable
boolean isOpen()
String remove(@NotNull String key)
key
- Key to removeString get(@NotNull String key)
key
- Key to get the value fordefault String getOrDefault(@NotNull String key, String defaultValue)
key
- Key to get the value fordefaultValue
- A default value in case key is nullboolean isHealthy()
String put(@NotNull String key, String value)
Also removes the key if the value is null.
key
- Key to setvalue
- Value to set for the given keyMap<String,String> putAll(@NotNull Map<String,String> entries)
Removes any keys with a null value.
entries
- Map of key/value pairs to putdefault void replaceStore(String newStorePath)
newStorePath
- The location of the new store.Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.