Interface RBatch

All Known Implementing Classes:
RedissonBatch

public interface RBatch
Interface for using Redis pipeline feature.

All method invocations on objects got through this interface are batched to separate queue and could be executed later with execute() or executeAsync() methods.

Author:
Nikita Koksharov
  • Method Details

    • getStream

      <K, V> RStreamAsync<K,V> getStream(String name)
      Returns stream instance by name
      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - of stream
      Returns:
      RStream object
    • getStream

      <K, V> RStreamAsync<K,V> getStream(String name, Codec codec)
      Returns stream instance by name using provided codec for entries.
      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - - name of stream
      codec - - codec for entry
      Returns:
      RStream object
    • getGeo

      <V> RGeoAsync<V> getGeo(String name)
      Returns geospatial items holder instance by name.
      Type Parameters:
      V - type of object
      Parameters:
      name - - name of object
      Returns:
      Geo object
    • getGeo

      <V> RGeoAsync<V> getGeo(String name, Codec codec)
      Returns geospatial items holder instance by name using provided codec for geospatial members.
      Type Parameters:
      V - type of value
      Parameters:
      name - - name of object
      codec - - codec for value
      Returns:
      Geo object
    • getSetMultimap

      <K, V> RMultimapAsync<K,V> getSetMultimap(String name)
      Returns Set based MultiMap instance by name.
      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      Multimap object
    • getSetMultimap

      <K, V> RMultimapAsync<K,V> getSetMultimap(String name, Codec codec)
      Returns Set based MultiMap instance by name using provided codec for both map keys and values.
      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - - name of object
      codec - - provided codec
      Returns:
      Multimap object
    • getSetMultimapCache

      <K, V> RMultimapCacheAsync<K,V> getSetMultimapCache(String name)
      Returns Set based Multimap instance by name. Supports key-entry eviction with a given TTL value.

      If eviction is not required then it's better to use regular map getSetMultimap(String).

      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      SetMultimapCache object
    • getSetMultimapCache

      <K, V> RMultimapCacheAsync<K,V> getSetMultimapCache(String name, Codec codec)
      Returns Set based Multimap instance by name using provided codec for both map keys and values. Supports key-entry eviction with a given TTL value.

      If eviction is not required then it's better to use regular map getSetMultimap(String, Codec).

      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - - name of object
      codec - - provided codec
      Returns:
      SetMultimapCache object
    • getSetCache

      <V> RSetCacheAsync<V> getSetCache(String name)
      Returns set-based cache instance by name. Uses map (value_hash, value) under the hood for minimal memory consumption. Supports value eviction with a given TTL value.

      If eviction is not required then it's better to use regular map getSet(String, Codec).

      Type Parameters:
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      SetCache object
    • getSetCache

      <V> RSetCacheAsync<V> getSetCache(String name, Codec codec)
      Returns set-based cache instance by name using provided codec for values. Uses map (value_hash, value) under the hood for minimal memory consumption. Supports value eviction with a given TTL value.

      If eviction is not required then it's better to use regular map getSet(String, Codec).

      Type Parameters:
      V - type of value
      Parameters:
      name - - name of object
      codec - - codec for values
      Returns:
      SetCache object
    • getMapCache

      <K, V> RMapCacheAsync<K,V> getMapCache(String name, Codec codec)
      Returns map-based cache instance by name using provided codec for both cache keys and values. Supports entry eviction with a given TTL value.

      If eviction is not required then it's better to use regular map getMap(String, Codec).

      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - - name of object
      codec - - codec for keys and values
      Returns:
      MapCache object
    • getMapCache

      <K, V> RMapCacheAsync<K,V> getMapCache(String name)
      Returns map-based cache instance by name. Supports entry eviction with a given TTL value.

      If eviction is not required then it's better to use regular map getMap(String).

      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      MapCache object
    • getMapCacheNative

      <K, V> RMapCacheNativeAsync<K,V> getMapCacheNative(String name)
      Returns map instance by name. Supports entry eviction with a given TTL.

      Requires Redis 7.4.0 and higher.

      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - name of object
      Returns:
      Map object
    • getMapCacheNative

      <K, V> RMapCacheNativeAsync<K,V> getMapCacheNative(String name, Codec codec)
      Returns map instance by name using provided codec for both map keys and values. Supports entry eviction with a given TTL.

      Requires Redis 7.4.0 and higher.

      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - name of object
      codec - codec for keys and values
      Returns:
      Map object
    • getBucket

      <V> RBucketAsync<V> getBucket(String name)
      Returns object holder by name
      Type Parameters:
      V - type of object
      Parameters:
      name - - name of object
      Returns:
      Bucket object
    • getBucket

      <V> RBucketAsync<V> getBucket(String name, Codec codec)
    • getJsonBucket

      <V> RJsonBucketAsync<V> getJsonBucket(String name, JsonCodec codec)
      Returns JSON data holder instance by name using provided codec.
      Type Parameters:
      V - type of value
      Parameters:
      name - name of object
      codec - codec for values
      Returns:
      JsonBucket object
      See Also:
    • getHyperLogLog

      <V> RHyperLogLogAsync<V> getHyperLogLog(String name)
      Returns HyperLogLog object
      Type Parameters:
      V - type of object
      Parameters:
      name - - name of object
      Returns:
      HyperLogLog object
    • getHyperLogLog

      <V> RHyperLogLogAsync<V> getHyperLogLog(String name, Codec codec)
    • getList

      <V> RListAsync<V> getList(String name)
      Returns list instance by name.
      Type Parameters:
      V - type of object
      Parameters:
      name - - name of object
      Returns:
      List object
    • getList

      <V> RListAsync<V> getList(String name, Codec codec)
    • getListMultimap

      <K, V> RMultimapAsync<K,V> getListMultimap(String name)
      Returns List based MultiMap instance by name.
      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      ListMultimap object
    • getListMultimap

      <K, V> RMultimapAsync<K,V> getListMultimap(String name, Codec codec)
      Returns List based MultiMap instance by name using provided codec for both map keys and values.
      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - - name of object
      codec - - codec for keys and values
      Returns:
      ListMultimap object
    • getListMultimapCache

      <K, V> RMultimapCacheAsync<K,V> getListMultimapCache(String name)
      Returns List based Multimap instance by name. Supports key-entry eviction with a given TTL value.

      If eviction is not required then it's better to use regular map getSetMultimap(String).

      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      ListMultimapCache object
    • getListMultimapCache

      <K, V> RMultimapCacheAsync<K,V> getListMultimapCache(String name, Codec codec)
      Returns List based Multimap instance by name using provided codec for both map keys and values. Supports key-entry eviction with a given TTL value.

      If eviction is not required then it's better to use regular map getSetMultimap(String, Codec).

      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - - name of object
      codec - - codec for keys and values
      Returns:
      ListMultimapCache object
    • getListMultimapCacheNative

      <K, V> RMultimapCacheAsync<K,V> getListMultimapCacheNative(String name)
      Returns List based Multimap instance by name. Supports key-entry eviction with a given TTL value. Stores insertion order and allows duplicates for values mapped to key.

      Uses Redis native commands for entry expiration and not a scheduled eviction task.

      Requires Redis 7.4.0 and higher.

      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - name of object
      Returns:
      ListMultimapCache object
    • getListMultimapCacheNative

      <K, V> RMultimapCacheAsync<K,V> getListMultimapCacheNative(String name, Codec codec)
      Returns List based Multimap instance by name using provided codec for both map keys and values. Supports key-entry eviction with a given TTL value. Stores insertion order and allows duplicates for values mapped to key.

      Uses Redis native commands for entry expiration and not a scheduled eviction task.

      Requires Redis 7.4.0 and higher.

      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - name of object
      codec - codec for keys and values
      Returns:
      ListMultimapCache object
    • getSetMultimapCacheNative

      <K, V> RMultimapCacheAsync<K,V> getSetMultimapCacheNative(String name)
      Returns Set based Multimap instance by name. Supports key-entry eviction with a given TTL value. Doesn't allow duplications for values mapped to key.

      Uses Redis native commands for entry expiration and not a scheduled eviction task.

      Requires Redis 7.4.0 and higher.

      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - name of object
      Returns:
      SetMultimapCache object
    • getSetMultimapCacheNative

      <K, V> RMultimapCacheAsync<K,V> getSetMultimapCacheNative(String name, Codec codec)
      Returns Set based Multimap instance by name using provided codec for both map keys and values. Supports key-entry eviction with a given TTL value. Doesn't allow duplications for values mapped to key.

      Uses Redis native commands for entry expiration and not a scheduled eviction task.

      Requires Redis 7.4.0 and higher.

      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - name of object
      codec - codec for keys and values
      Returns:
      SetMultimapCache object
    • getMap

      <K, V> RMapAsync<K,V> getMap(String name)
      Returns map instance by name.
      Type Parameters:
      K - type of key
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      Map object
    • getMap

      <K, V> RMapAsync<K,V> getMap(String name, Codec codec)
    • getSet

      <V> RSetAsync<V> getSet(String name)
      Returns set instance by name.
      Type Parameters:
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      Set object
    • getSet

      <V> RSetAsync<V> getSet(String name, Codec codec)
    • getTopic

      RTopicAsync getTopic(String name)
      Returns topic instance by name.
      Parameters:
      name - - name of object
      Returns:
      Topic object
    • getTopic

      RTopicAsync getTopic(String name, Codec codec)
    • getShardedTopic

      RShardedTopicAsync getShardedTopic(String name)
      Returns Sharded Topic instance by name.

      Messages are delivered to message listeners connected to the same Topic.

      Parameters:
      name - - name of object
      Returns:
      Topic object
    • getShardedTopic

      RShardedTopicAsync getShardedTopic(String name, Codec codec)
      Returns Sharded Topic instance by name using provided codec for messages.

      Messages are delivered to message listeners connected to the same Topic.

      Parameters:
      name - - name of object
      codec - - codec for message
      Returns:
      Topic object
    • getQueue

      <V> RQueueAsync<V> getQueue(String name)
      Returns queue instance by name.
      Type Parameters:
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      Queue object
    • getQueue

      <V> RQueueAsync<V> getQueue(String name, Codec codec)
    • getBlockingQueue

      <V> RBlockingQueueAsync<V> getBlockingQueue(String name)
      Returns blocking queue instance by name.
      Type Parameters:
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      BlockingQueue object
    • getBlockingQueue

      <V> RBlockingQueueAsync<V> getBlockingQueue(String name, Codec codec)
    • getDeque

      <V> RDequeAsync<V> getDeque(String name)
      Returns deque instance by name.
      Type Parameters:
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      Deque object
    • getDeque

      <V> RDequeAsync<V> getDeque(String name, Codec codec)
    • getBlockingDeque

      <V> RBlockingDequeAsync<V> getBlockingDeque(String name)
      Returns blocking deque instance by name.
      Type Parameters:
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      BlockingDeque object
    • getBlockingDeque

      <V> RBlockingDequeAsync<V> getBlockingDeque(String name, Codec codec)
    • getAtomicLong

      RAtomicLongAsync getAtomicLong(String name)
      Returns atomicLong instance by name.
      Parameters:
      name - - name of object
      Returns:
      AtomicLong object
    • getAtomicDouble

      RAtomicDoubleAsync getAtomicDouble(String name)
      Returns atomicDouble instance by name.
      Parameters:
      name - - name of object
      Returns:
      AtomicDouble object
    • getScoredSortedSet

      <V> RScoredSortedSetAsync<V> getScoredSortedSet(String name)
      Returns Redis Sorted Set instance by name
      Type Parameters:
      V - type of value
      Parameters:
      name - - name of object
      Returns:
      ScoredSortedSet object
    • getScoredSortedSet

      <V> RScoredSortedSetAsync<V> getScoredSortedSet(String name, Codec codec)
    • getLexSortedSet

      RLexSortedSetAsync getLexSortedSet(String name)
      Returns String based Redis Sorted Set instance by name All elements are inserted with the same score during addition, in order to force lexicographical ordering
      Parameters:
      name - - name of object
      Returns:
      LexSortedSet object
    • getBitSet

      RBitSetAsync getBitSet(String name)
      Returns bitSet instance by name.
      Parameters:
      name - - name of object
      Returns:
      BitSet object
    • getScript

      RScriptAsync getScript()
      Returns script operations object
      Returns:
      Script object
    • getScript

      RScriptAsync getScript(Codec codec)
      Returns script operations object using provided codec.
      Parameters:
      codec - - codec for params and result
      Returns:
      Script object
    • getFunction

      RFunctionAsync getFunction()
      Returns interface for Redis Function feature
      Returns:
      function object
    • getFunction

      RFunctionAsync getFunction(Codec codec)
      Returns interface for Redis Function feature using provided codec
      Parameters:
      codec - - codec for params and result
      Returns:
      function interface
    • getKeys

      RKeysAsync getKeys()
      Returns keys operations. Each of Redis/Redisson object associated with own key
      Returns:
      Keys object
    • getSearch

      RSearchAsync getSearch()
      Returns API for RediSearch module
      Returns:
      RSearchAsync object
    • getSearch

      RSearchAsync getSearch(Codec codec)
      Returns API for RediSearch module using defined codec for attribute values.
      Parameters:
      codec - codec for entry
      Returns:
      RSearchAsync object
    • execute

      BatchResult<?> execute() throws RedisException
      Executes all operations accumulated during async methods invocations.

      If cluster configuration used then operations are grouped by slot ids and may be executed on different servers. Thus command execution order could be changed

      Returns:
      List with result object for each command
      Throws:
      RedisException - in case of any error
    • executeAsync

      RFuture<BatchResult<?>> executeAsync()
      Executes all operations accumulated during async methods invocations asynchronously.

      In cluster configurations operations grouped by slot ids so may be executed on different servers. Thus command execution order could be changed

      Returns:
      List with result object for each command
    • discard

      void discard()
      Discard batched commands and release allocated buffers used for parameters encoding.
    • discardAsync

      RFuture<Void> discardAsync()
      Discard batched commands and release allocated buffers used for parameters encoding.
      Returns:
      void