public class RedisStore extends Object implements KeyValueStore
| Constructor and Description | 
|---|
RedisStore(String storeName,
          redis.clients.jedis.JedisPool pool,
          String redisNamespace)
Build a connection to a Redis provider. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
close()
Close the store. 
 | 
String | 
get(String key)
Get the value for a key from store. 
 | 
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. 
 | 
void | 
removeAllKeys()
Remove all keys associated with the store. 
 | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetOrDefault, replaceStorepublic RedisStore(String storeName, redis.clients.jedis.JedisPool pool, String redisNamespace)
storeName - The second part of the prefix to keyspace names for this storepool - A pool of Jedis connection instancesredisNamespace - The first part of the prefix to the keyspace names for this storepublic void open()
KeyValueStoreopen in interface KeyValueStorepublic void close()
KeyValueStoreclose in interface KeyValueStoreclose in interface Closeableclose in interface AutoCloseablepublic boolean isOpen()
KeyValueStoreisOpen in interface KeyValueStorepublic void removeAllKeys()
This is mainly used for tests; the Redis command used to get the associated keys (KEYS) is rather expensive and shouldn't be run frequently.
public String remove(@NotNull String key)
KeyValueStoreremove in interface KeyValueStorekey - Key to removepublic String get(@NotNull String key)
KeyValueStoreget in interface KeyValueStorekey - Key to get the value forpublic boolean isHealthy()
KeyValueStoreisHealthy in interface KeyValueStorepublic String put(@NotNull String key, String value)
KeyValueStoreAlso removes the key if the value is null.
put in interface KeyValueStorekey - Key to setvalue - Value to set for the given keypublic Map<String,String> putAll(@NotNull Map<String,String> entries)
KeyValueStoreRemoves any keys with a null value.
putAll in interface KeyValueStoreentries - Map of key/value pairs to putCopyright © 2016–2018 Yahoo! Inc.. All rights reserved.