Class RedisMetadataStore
java.lang.Object
org.springframework.integration.redis.metadata.RedisMetadataStore
- All Implemented Interfaces:
org.springframework.integration.metadata.ConcurrentMetadataStore,org.springframework.integration.metadata.MetadataStore
public class RedisMetadataStore
extends java.lang.Object
implements org.springframework.integration.metadata.ConcurrentMetadataStore
Redis implementation of
ConcurrentMetadataStore. Use this
ConcurrentMetadataStore to achieve meta-data persistence across application
restarts.
This implementation is based on the RedisProperties and its
replace(String, String, String); it can't currently be used with a Redis
cluster because the WATCH command is not supported.
- Since:
- 3.0
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringKEY -
Constructor Summary
Constructors Constructor Description RedisMetadataStore(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory)RedisMetadataStore(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory, java.lang.String key)Initializes theRedisPropertiesby providedRedisConnectionFactoryand key.RedisMetadataStore(org.springframework.data.redis.core.RedisOperations<java.lang.String,?> operations)RedisMetadataStore(org.springframework.data.redis.core.RedisOperations<java.lang.String,?> operations, java.lang.String key)Initializes theRedisPropertiesby providedRedisConnectionFactoryand key.RedisMetadataStore(org.springframework.data.redis.support.collections.RedisProperties properties)Specifies theRedisPropertiesbackend for thisConcurrentMetadataStore. -
Method Summary
Modifier and Type Method Description java.lang.Stringget(java.lang.String key)Retrieve the persisted value for the provided key.voidput(java.lang.String key, java.lang.String value)Persists the provided key and value to Redis.java.lang.StringputIfAbsent(java.lang.String key, java.lang.String value)java.lang.Stringremove(java.lang.String key)booleanreplace(java.lang.String key, java.lang.String oldValue, java.lang.String newValue)
-
Field Details
-
KEY
public static final java.lang.String KEY- See Also:
- Constant Field Values
-
-
Constructor Details
-
RedisMetadataStore
public RedisMetadataStore(org.springframework.data.redis.support.collections.RedisProperties properties)Specifies theRedisPropertiesbackend for thisConcurrentMetadataStore.- Parameters:
properties- The properties.
-
RedisMetadataStore
public RedisMetadataStore(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory)- Parameters:
connectionFactory- The connection factory.
-
RedisMetadataStore
public RedisMetadataStore(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory, java.lang.String key)Initializes theRedisPropertiesby providedRedisConnectionFactoryand key.- Parameters:
connectionFactory- The connection factory.key- The key.
-
RedisMetadataStore
public RedisMetadataStore(org.springframework.data.redis.core.RedisOperations<java.lang.String,?> operations)- Parameters:
operations- The Redis operations object.
-
RedisMetadataStore
public RedisMetadataStore(org.springframework.data.redis.core.RedisOperations<java.lang.String,?> operations, java.lang.String key)Initializes theRedisPropertiesby providedRedisConnectionFactoryand key.- Parameters:
operations- The Redis operations object.key- The key.
-
-
Method Details
-
put
public void put(java.lang.String key, java.lang.String value)Persists the provided key and value to Redis.- Specified by:
putin interfaceorg.springframework.integration.metadata.MetadataStore- Parameters:
key- Must not be nullvalue- Must not be null
-
get
public java.lang.String get(java.lang.String key)Retrieve the persisted value for the provided key.- Specified by:
getin interfaceorg.springframework.integration.metadata.MetadataStore- Parameters:
key- Must not be null
-
remove
public java.lang.String remove(java.lang.String key)- Specified by:
removein interfaceorg.springframework.integration.metadata.MetadataStore
-
putIfAbsent
public java.lang.String putIfAbsent(java.lang.String key, java.lang.String value)- Specified by:
putIfAbsentin interfaceorg.springframework.integration.metadata.ConcurrentMetadataStore
-
replace
public boolean replace(java.lang.String key, java.lang.String oldValue, java.lang.String newValue)- Specified by:
replacein interfaceorg.springframework.integration.metadata.ConcurrentMetadataStore
-