Class RedisEnhancedKeyValueAdapter

java.lang.Object
org.springframework.data.keyvalue.core.AbstractKeyValueAdapter
org.springframework.data.redis.core.RedisKeyValueAdapter
com.redis.om.spring.RedisEnhancedKeyValueAdapter
All Implemented Interfaces:
EventListener, org.springframework.beans.factory.Aware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.data.redis.core.RedisKeyspaceEvent>, org.springframework.data.keyvalue.core.KeyValueAdapter

public class RedisEnhancedKeyValueAdapter extends org.springframework.data.redis.core.RedisKeyValueAdapter
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.data.redis.core.RedisKeyValueAdapter

    org.springframework.data.redis.core.RedisKeyValueAdapter.EnableKeyspaceEvents, org.springframework.data.redis.core.RedisKeyValueAdapter.ShadowCopy
  • Constructor Summary

    Constructors
    Constructor
    Description
    RedisEnhancedKeyValueAdapter(org.springframework.data.redis.core.RedisOperations<?,?> redisOps, RedisModulesOperations<?> rmo, RediSearchIndexer indexer, Embedder embedder, RedisOMProperties redisOMProperties)
    Creates new RedisKeyValueAdapter with default RedisMappingContext and default RedisCustomConversions.
    RedisEnhancedKeyValueAdapter(org.springframework.data.redis.core.RedisOperations<?,?> redisOps, RedisModulesOperations<?> rmo, org.springframework.data.redis.core.mapping.RedisMappingContext mappingContext, RediSearchIndexer indexer, Embedder embedder, RedisOMProperties redisOMProperties)
    Creates new RedisKeyValueAdapter with default RedisCustomConversions.
    RedisEnhancedKeyValueAdapter(org.springframework.data.redis.core.RedisOperations<?,?> redisOps, RedisModulesOperations<?> rmo, org.springframework.data.redis.core.mapping.RedisMappingContext mappingContext, org.springframework.data.convert.CustomConversions customConversions, RediSearchIndexer indexer, Embedder embedder, RedisOMProperties redisOMProperties)
    Creates new RedisKeyValueAdapter.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(Object id, String keyspace)
     
    long
    count(String keyspace)
     
    byte[]
    createKey(String keyspace, String id)
    Creates a new
    invalid reference
    key
    using the given keyspace and id.
    <T> T
    delete(Object id, String keyspace, Class<T> type)
     
    void
    deleteAllOf(String keyspace)
     
    <T> T
    get(Object id, String keyspace, Class<T> type)
     
    <T> List<String>
    getAllIds(String keyspace, Class<T> type)
     
    <T> List<T>
    getAllOf(String keyspace, Class<T> type, long offset, int rows)
    Get all elements for given keyspace.
    protected String
    getKey(String keyspace, Object id)
     
    put(Object id, Object item, String keyspace)
     
    void
    update(org.springframework.data.redis.core.PartialUpdate<?> update)
     

    Methods inherited from class org.springframework.data.redis.core.RedisKeyValueAdapter

    afterPropertiesSet, clear, delete, destroy, entries, execute, get, getAllOf, getAllOf, getConverter, onApplicationEvent, setApplicationContext, setEnableKeyspaceEvents, setKeyspaceNotificationsConfigParameter, setMessageListenerContainer, setShadowCopy, toBytes

    Methods inherited from class org.springframework.data.keyvalue.core.AbstractKeyValueAdapter

    count, find, find, getQueryEngine

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.context.ApplicationListener

    supportsAsyncExecution

    Methods inherited from interface org.springframework.data.keyvalue.core.KeyValueAdapter

    entries, exists
  • Constructor Details

    • RedisEnhancedKeyValueAdapter

      public RedisEnhancedKeyValueAdapter(org.springframework.data.redis.core.RedisOperations<?,?> redisOps, RedisModulesOperations<?> rmo, RediSearchIndexer indexer, Embedder embedder, RedisOMProperties redisOMProperties)
      Creates new RedisKeyValueAdapter with default RedisMappingContext and default RedisCustomConversions.
      Parameters:
      redisOps - must not be null.
      rmo - must not be null.
      indexer - must not be null.
    • RedisEnhancedKeyValueAdapter

      public RedisEnhancedKeyValueAdapter(org.springframework.data.redis.core.RedisOperations<?,?> redisOps, RedisModulesOperations<?> rmo, org.springframework.data.redis.core.mapping.RedisMappingContext mappingContext, RediSearchIndexer indexer, Embedder embedder, RedisOMProperties redisOMProperties)
      Creates new RedisKeyValueAdapter with default RedisCustomConversions.
      Parameters:
      redisOps - must not be null.
      rmo - must not be null.
      mappingContext - must not be null.
      indexer - must not be null.
    • RedisEnhancedKeyValueAdapter

      public RedisEnhancedKeyValueAdapter(org.springframework.data.redis.core.RedisOperations<?,?> redisOps, RedisModulesOperations<?> rmo, org.springframework.data.redis.core.mapping.RedisMappingContext mappingContext, @Nullable org.springframework.data.convert.CustomConversions customConversions, RediSearchIndexer indexer, Embedder embedder, RedisOMProperties redisOMProperties)
      Creates new RedisKeyValueAdapter.
      Parameters:
      redisOps - must not be null.
      rmo - must not be null.
      mappingContext - must not be null.
      customConversions - can be null.
      indexer - must not be null.
  • Method Details

    • put

      public Object put(Object id, Object item, String keyspace)
      Specified by:
      put in interface org.springframework.data.keyvalue.core.KeyValueAdapter
      Overrides:
      put in class org.springframework.data.redis.core.RedisKeyValueAdapter
    • get

      @Nullable public <T> T get(Object id, String keyspace, Class<T> type)
      Specified by:
      get in interface org.springframework.data.keyvalue.core.KeyValueAdapter
      Overrides:
      get in class org.springframework.data.redis.core.RedisKeyValueAdapter
    • deleteAllOf

      public void deleteAllOf(String keyspace)
      Specified by:
      deleteAllOf in interface org.springframework.data.keyvalue.core.KeyValueAdapter
      Overrides:
      deleteAllOf in class org.springframework.data.redis.core.RedisKeyValueAdapter
    • getAllIds

      public <T> List<String> getAllIds(String keyspace, Class<T> type)
    • getAllOf

      public <T> List<T> getAllOf(String keyspace, Class<T> type, long offset, int rows)
      Get all elements for given keyspace.
      Overrides:
      getAllOf in class org.springframework.data.redis.core.RedisKeyValueAdapter
      Type Parameters:
      T - the target type
      Parameters:
      keyspace - the keyspace to fetch entities from.
      type - the desired target type.
      offset - index value to start reading.
      rows - maximum number of entities to return.
      Returns:
      never null.
      Since:
      2.5
    • delete

      public <T> T delete(Object id, String keyspace, Class<T> type)
      Specified by:
      delete in interface org.springframework.data.keyvalue.core.KeyValueAdapter
      Overrides:
      delete in class org.springframework.data.redis.core.RedisKeyValueAdapter
    • count

      public long count(String keyspace)
      Specified by:
      count in interface org.springframework.data.keyvalue.core.KeyValueAdapter
      Overrides:
      count in class org.springframework.data.redis.core.RedisKeyValueAdapter
    • contains

      public boolean contains(Object id, String keyspace)
      Specified by:
      contains in interface org.springframework.data.keyvalue.core.KeyValueAdapter
      Overrides:
      contains in class org.springframework.data.redis.core.RedisKeyValueAdapter
    • update

      public void update(org.springframework.data.redis.core.PartialUpdate<?> update)
      Overrides:
      update in class org.springframework.data.redis.core.RedisKeyValueAdapter
    • getKey

      protected String getKey(String keyspace, Object id)
    • createKey

      public byte[] createKey(String keyspace, String id)
      Creates a new
      invalid reference
      key
      using the given keyspace and id.
      Overrides:
      createKey in class org.springframework.data.redis.core.RedisKeyValueAdapter
      Parameters:
      keyspace - name of the Redis keyspace.
      id - String identifying the key.
      Returns:
      a
      invalid reference
      byte[]
      constructed from the keyspace and id.