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

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RedisMetadataStore(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory)
    Initializes the RedisProperties by provided RedisConnectionFactory and default hash key - KEY.
    RedisMetadataStore(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory, String key)
    Initializes the RedisProperties by provided RedisConnectionFactory and key.
    RedisMetadataStore(org.springframework.data.redis.core.RedisOperations<String,?> operations)
    Initializes the RedisProperties by provided RedisConnectionFactory and default hash key - KEY.
    RedisMetadataStore(org.springframework.data.redis.core.RedisOperations<String,?> operations, String key)
    Initializes the RedisProperties by provided RedisConnectionFactory and key.
    RedisMetadataStore(org.springframework.data.redis.support.collections.RedisProperties properties)
    Specifies the RedisProperties backend for this ConcurrentMetadataStore.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable String
    get(String key)
    Retrieve the persisted value for the provided key.
    void
    put(String key, String value)
    Persists the provided key and value to Redis.
    @Nullable String
    putIfAbsent(String key, String value)
     
    @Nullable String
     
    boolean
    replace(String key, String oldValue, String newValue)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • RedisMetadataStore

      public RedisMetadataStore(org.springframework.data.redis.support.collections.RedisProperties properties)
      Specifies the RedisProperties backend for this ConcurrentMetadataStore.
      Parameters:
      properties - The properties.
    • RedisMetadataStore

      public RedisMetadataStore(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory)
      Initializes the RedisProperties by provided RedisConnectionFactory and default hash key - KEY.
      Parameters:
      connectionFactory - The connection factory.
    • RedisMetadataStore

      public RedisMetadataStore(org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory, String key)
      Initializes the RedisProperties by provided RedisConnectionFactory and key.
      Parameters:
      connectionFactory - The connection factory.
      key - The key.
    • RedisMetadataStore

      public RedisMetadataStore(org.springframework.data.redis.core.RedisOperations<String,?> operations)
      Initializes the RedisProperties by provided RedisConnectionFactory and default hash key - KEY.
      Parameters:
      operations - The Redis operations object.
    • RedisMetadataStore

      public RedisMetadataStore(org.springframework.data.redis.core.RedisOperations<String,?> operations, String key)
      Initializes the RedisProperties by provided RedisConnectionFactory and key.
      Parameters:
      operations - The Redis operations object.
      key - The key.
  • Method Details

    • put

      public void put(String key, String value)
      Persists the provided key and value to Redis.
      Specified by:
      put in interface org.springframework.integration.metadata.MetadataStore
      Parameters:
      key - Must not be null
      value - Must not be null
    • get

      public @Nullable String get(String key)
      Retrieve the persisted value for the provided key.
      Specified by:
      get in interface org.springframework.integration.metadata.MetadataStore
      Parameters:
      key - Must not be null
    • remove

      public @Nullable String remove(String key)
      Specified by:
      remove in interface org.springframework.integration.metadata.MetadataStore
    • putIfAbsent

      public @Nullable String putIfAbsent(String key, String value)
      Specified by:
      putIfAbsent in interface org.springframework.integration.metadata.ConcurrentMetadataStore
    • replace

      public boolean replace(String key, String oldValue, String newValue)
      Specified by:
      replace in interface org.springframework.integration.metadata.ConcurrentMetadataStore