Class RedisMetadataStore
java.lang.Object
org.springframework.integration.redis.metadata.RedisMetadataStore
- All Implemented Interfaces:
ConcurrentMetadataStore,MetadataStore
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
- Author:
- Gunnar Hillert, Artem Bilan
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRedisMetadataStore(RedisConnectionFactory connectionFactory) RedisMetadataStore(RedisConnectionFactory connectionFactory, String key) Initializes theRedisPropertiesby providedRedisConnectionFactoryand key.RedisMetadataStore(RedisOperations<String, ?> operations) RedisMetadataStore(RedisOperations<String, ?> operations, String key) Initializes theRedisPropertiesby providedRedisConnectionFactoryand key.RedisMetadataStore(RedisProperties properties) Specifies theRedisPropertiesbackend for thisConcurrentMetadataStore. -
Method Summary
Modifier and TypeMethodDescription@Nullable StringRetrieve the persisted value for the provided key.voidPersists the provided key and value to Redis.@Nullable StringputIfAbsent(String key, String value) Atomically insert the key into the store.@Nullable StringRemove a value for the given key from this MetadataStore.booleanAtomically replace the value for the key in the store if the old value matches the oldValue argument.
-
Field Details
-
KEY
- See Also:
-
-
Constructor Details
-
RedisMetadataStore
Specifies theRedisPropertiesbackend for thisConcurrentMetadataStore.- Parameters:
properties- The properties.
-
RedisMetadataStore
- Parameters:
connectionFactory- The connection factory.
-
RedisMetadataStore
Initializes theRedisPropertiesby providedRedisConnectionFactoryand key.- Parameters:
connectionFactory- The connection factory.key- The key.
-
RedisMetadataStore
- Parameters:
operations- The Redis operations object.
-
RedisMetadataStore
Initializes theRedisPropertiesby providedRedisConnectionFactoryand key.- Parameters:
operations- The Redis operations object.key- The key.
-
-
Method Details
-
put
Persists the provided key and value to Redis.- Specified by:
putin interfaceMetadataStore- Parameters:
key- Must not be nullvalue- Must not be null
-
get
Retrieve the persisted value for the provided key.- Specified by:
getin interfaceMetadataStore- Parameters:
key- Must not be null- Returns:
- The value.
-
remove
Description copied from interface:MetadataStoreRemove a value for the given key from this MetadataStore.- Specified by:
removein interfaceMetadataStore- Parameters:
key- The key.- Returns:
- The previous value associated with key, or null if there was no mapping for key.
-
putIfAbsent
Description copied from interface:ConcurrentMetadataStoreAtomically insert the key into the store.- Specified by:
putIfAbsentin interfaceConcurrentMetadataStore- Parameters:
key- The key.value- The value.- Returns:
- null if successful, the old value otherwise.
-
replace
Description copied from interface:ConcurrentMetadataStoreAtomically replace the value for the key in the store if the old value matches the oldValue argument.- Specified by:
replacein interfaceConcurrentMetadataStore- Parameters:
key- The key.oldValue- The old value.newValue- The new value.- Returns:
- true if successful.
-