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 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
-
Constructor Summary
ConstructorDescriptionRedisMetadataStore
(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory) RedisMetadataStore
(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory, String key) Initializes theRedisProperties
by providedRedisConnectionFactory
and key.RedisMetadataStore
(org.springframework.data.redis.core.RedisOperations<String, ?> operations) RedisMetadataStore
(org.springframework.data.redis.core.RedisOperations<String, ?> operations, String key) Initializes theRedisProperties
by providedRedisConnectionFactory
and key.RedisMetadataStore
(org.springframework.data.redis.support.collections.RedisProperties properties) Specifies theRedisProperties
backend for thisConcurrentMetadataStore
. -
Method Summary
Modifier and TypeMethodDescriptionRetrieve the persisted value for the provided key.void
Persists the provided key and value to Redis.putIfAbsent
(String key, String value) boolean
-
Field Details
-
KEY
- See Also:
-
-
Constructor Details
-
RedisMetadataStore
public RedisMetadataStore(org.springframework.data.redis.support.collections.RedisProperties properties) Specifies theRedisProperties
backend 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, String key) Initializes theRedisProperties
by providedRedisConnectionFactory
and key.- Parameters:
connectionFactory
- The connection factory.key
- The key.
-
RedisMetadataStore
- Parameters:
operations
- The Redis operations object.
-
RedisMetadataStore
public RedisMetadataStore(org.springframework.data.redis.core.RedisOperations<String, ?> operations, String key) Initializes theRedisProperties
by providedRedisConnectionFactory
and key.- Parameters:
operations
- The Redis operations object.key
- The key.
-
-
Method Details
-
put
Persists the provided key and value to Redis.- Specified by:
put
in interfaceorg.springframework.integration.metadata.MetadataStore
- Parameters:
key
- Must not be nullvalue
- Must not be null
-
get
Retrieve the persisted value for the provided key.- Specified by:
get
in interfaceorg.springframework.integration.metadata.MetadataStore
- Parameters:
key
- Must not be null
-
remove
- Specified by:
remove
in interfaceorg.springframework.integration.metadata.MetadataStore
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceorg.springframework.integration.metadata.ConcurrentMetadataStore
-
replace
- Specified by:
replace
in interfaceorg.springframework.integration.metadata.ConcurrentMetadataStore
-