org.redisson.api.RBatchRx Maven / Gradle / Ivy
Show all versions of redisson-all Show documentation
/**
* Copyright (c) 2013-2024 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.redisson.api;
import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.core.Maybe;
import org.redisson.client.codec.Codec;
import org.redisson.codec.JsonCodec;
/**
* RxJava2 interface for Redis pipeline feature.
*
* All method invocations on objects
* from this interface are batched to separate queue and could be executed later
* with execute()
method.
*
*
* @author Nikita Koksharov
*
*/
public interface RBatchRx {
/**
* Returns stream instance by name
*
* Requires Redis 5.0.0 and higher.
*
* @param type of key
* @param type of value
* @param name of stream
* @return RStream object
*/
RStreamRx getStream(String name);
/**
* Returns stream instance by name
* using provided codec
for entries.
*
* Requires Redis 5.0.0 and higher.
*
* @param type of key
* @param type of value
* @param name - name of stream
* @param codec - codec for entry
* @return RStream object
*/
RStreamRx getStream(String name, Codec codec);
/**
* Returns geospatial items holder instance by name
.
*
* @param type of value
* @param name - name of object
* @return Geo object
*/
RGeoRx getGeo(String name);
/**
* Returns geospatial items holder instance by name
* using provided codec for geospatial members.
*
* @param type of value
* @param name - name of object
* @param codec - codec for value
* @return Geo object
*/
RGeoRx getGeo(String name, Codec codec);
/**
* Returns Set based Multimap instance by name.
*
* @param type of key
* @param type of value
* @param name - name of object
* @return SetMultimap object
*/
RSetMultimapRx getSetMultimap(String name);
/**
* Returns Set based Multimap instance by name
* using provided codec for both map keys and values.
*
* @param type of key
* @param type of value
* @param name - name of object
* @param codec - codec for keys and values
* @return SetMultimap object
*/
RSetMultimapRx getSetMultimap(String name, Codec codec);
/**
* Returns Set based Multimap cache instance by name.
* Supports key eviction by specifying a time to live.
* If eviction is not required then it's better to use regular set multimap {@link #getSetMultimap(String)}.
*
* @param type of key
* @param type of value
* @param name - name of object
* @return RSetMultimapCacheRx object
*/
RSetMultimapCacheRx getSetMultimapCache(String name);
/**
* Returns Set based Multimap cache instance by name using provided codec for both map keys and values.
* Supports key eviction by specifying a time to live.
* If eviction is not required then it's better to use regular set multimap {@link #getSetMultimap(String, Codec)}.
*
* @param type of key
* @param type of value
* @param name - name of object
* @param codec - codec for keys and values
* @return RSetMultimapCacheRx object
*/
RSetMultimapCacheRx getSetMultimapCache(String name, Codec codec);
/**
* 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 {@link #getSet(String, Codec)}.
*
* @param type of value
* @param name - name of object
* @return SetCache object
*/
RSetCacheRx getSetCache(String name);
/**
* 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 {@link #getSet(String, Codec)}.
*
* @param type of value
* @param name - name of object
* @param codec - codec for values
* @return SetCache object
*/
RSetCacheRx getSetCache(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 {@link #getMap(String, Codec)}.
*
* @param type of key
* @param type of value
* @param name - name of object
* @param codec - codec for keys and values
* @return MapCache object
*/
RMapCacheRx getMapCache(String name, Codec codec);
/**
* 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 {@link #getMap(String)}.
*
* @param type of key
* @param type of value
* @param name - name of object
* @return MapCache object
*/
RMapCacheRx getMapCache(String name);
/**
* Returns map instance by name.
* Supports entry eviction with a given TTL.
*
* Requires Redis 7.4.0 and higher.
*
* @param type of key
* @param type of value
* @param name name of object
* @return Map object
*/
RMapCacheNativeRx getMapCacheNative(String name);
/**
* 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.
*
* @param type of key
* @param type of value
* @param name name of object
* @param codec codec for keys and values
* @return Map object
*/
RMapCacheNativeRx getMapCacheNative(String name, Codec codec);
/**
* 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.
*
* @param type of key
* @param type of value
* @param name name of object
* @return ListMultimapCache object
*/
RListMultimapCacheRx getListMultimapCacheNative(String name);
/**
* 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.
*
* @param type of key
* @param type of value
* @param name name of object
* @param codec codec for keys and values
* @return ListMultimapCache object
*/
RListMultimapCacheRx getListMultimapCacheNative(String name, Codec codec);
/**
* 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.
*
* @param type of key
* @param type of value
* @param name name of object
* @return SetMultimapCache object
*/
RSetMultimapCacheRx getSetMultimapCacheNative(String name);
/**
* 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.
*
* @param type of key
* @param type of value
* @param name name of object
* @param codec codec for keys and values
* @return SetMultimapCache object
*/
RSetMultimapCacheRx getSetMultimapCacheNative(String name, Codec codec);
/**
* Returns object holder by name
*
* @param type of value
* @param name - name of object
* @return Bucket object
*/
RBucketRx getBucket(String name);
RBucketRx getBucket(String name, Codec codec);
/**
* Returns JSON data holder instance by name using provided codec.
*
* @see org.redisson.codec.JacksonCodec
*
* @param type of value
* @param name name of object
* @param codec codec for values
* @return JsonBucket object
*/
RJsonBucketRx getJsonBucket(String name, JsonCodec codec);
/**
* Returns HyperLogLog object by name
*
* @param type of value
* @param name - name of object
* @return HyperLogLog object
*/
RHyperLogLogRx getHyperLogLog(String name);
RHyperLogLogRx getHyperLogLog(String name, Codec codec);
/**
* Returns list instance by name.
*
* @param type of value
* @param name - name of object
* @return List object
*/
RListRx getList(String name);
RListRx getList(String name, Codec codec);
/**
* Returns List based MultiMap instance by name.
*
* @param type of key
* @param type of value
* @param name - name of object
* @return ListMultimap object
*/
RListMultimapRx getListMultimap(String name);
/**
* Returns List based MultiMap instance by name
* using provided codec for both map keys and values.
*
* @param type of key
* @param type of value
* @param name - name of object
* @param codec - codec for keys and values
* @return ListMultimap object
*/
RListMultimapRx getListMultimap(String name, Codec codec);
/**
* Returns List based Multimap cache instance by name.
* Supports key eviction by specifying a time to live.
* If eviction is not required then it's better to use regular list multimap {@link #getListMultimap(String)}.
*
* @param type of key
* @param type of value
* @param name - name of object
* @return RListMultimapCacheRx object
*/
RListMultimapCacheRx getListMultimapCache(String name);
/**
* Returns List based Multimap cache instance by name using provided codec for both map keys and values.
* Supports key eviction by specifying a time to live.
* If eviction is not required then it's better to use regular list multimap {@link #getListMultimap(String, Codec)}.
*
* @param type of key
* @param type of value
* @param name - name of object
* @param codec - codec for keys and values
* @return RListMultimapCacheRx object
*/
RListMultimapCacheRx getListMultimapCache(String name, Codec codec);
/**
* Returns map instance by name.
*
* @param type of key
* @param type of value
* @param name - name of object
* @return Map object
*/
RMapRx getMap(String name);
RMapRx getMap(String name, Codec codec);
/**
* Returns set instance by name.
*
* @param type of value
* @param name - name of object
* @return Set object
*/
RSetRx getSet(String name);
RSetRx getSet(String name, Codec codec);
/**
* Returns topic instance by name.
*
* @param name - name of object
* @return Topic object
*/
RTopicRx getTopic(String name);
RTopicRx getTopic(String name, Codec codec);
/**
* Returns Sharded Topic instance by name.
*
* Messages are delivered to message listeners connected to the same Topic.
*
*
* @param name - name of object
* @return Topic object
*/
RShardedTopicRx getShardedTopic(String name);
/**
* Returns Sharded Topic instance by name using provided codec for messages.
*
* Messages are delivered to message listeners connected to the same Topic.
*
*
* @param name - name of object
* @param codec - codec for message
* @return Topic object
*/
RShardedTopicRx getShardedTopic(String name, Codec codec);
/**
* Returns queue instance by name.
*
* @param type of value
* @param name - name of object
* @return Queue object
*/
RQueueRx getQueue(String name);
RQueueRx getQueue(String name, Codec codec);
/**
* Returns blocking queue instance by name.
*
* @param type of value
* @param name - name of object
* @return BlockingQueue object
*/
RBlockingQueueRx getBlockingQueue(String name);
RBlockingQueueRx getBlockingQueue(String name, Codec codec);
/**
* Returns blocking deque instance by name.
*
* @param type of value
* @param name - name of object
* @return BlockingDeque object
*/
RBlockingDequeRx getBlockingDeque(String name);
RBlockingDequeRx getBlockingDeque(String name, Codec codec);
/**
* Returns deque instance by name.
*
* @param type of value
* @param name - name of object
* @return Deque object
*/
RDequeRx getDeque(String name);
RDequeRx getDeque(String name, Codec codec);
/**
* Returns "atomic long" instance by name.
*
* @param name - name of object
* @return AtomicLong object
*/
RAtomicLongRx getAtomicLong(String name);
/**
* Returns atomicDouble instance by name.
*
* @param name - name of object
* @return AtomicDouble object
*/
RAtomicDoubleRx getAtomicDouble(String name);
/**
* Returns Redis Sorted Set instance by name
*
* @param type of value
* @param name - name of object
* @return ScoredSortedSet object
*/
RScoredSortedSetRx getScoredSortedSet(String name);
RScoredSortedSetRx getScoredSortedSet(String name, Codec codec);
/**
* 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
*
* @param name - name of object
* @return LexSortedSet object
*/
RLexSortedSetRx getLexSortedSet(String name);
/**
* Returns bitSet instance by name.
*
* @param name of bitSet
* @return BitSet object
*/
RBitSetRx getBitSet(String name);
/**
* Returns script operations object
*
* @return Script object
*/
RScriptRx getScript();
/**
* Returns script operations object using provided codec.
*
* @param codec - codec for params and result
* @return Script object
*/
RScriptRx getScript(Codec codec);
/**
* Returns interface for Redis Function feature
*
* @return function object
*/
RFunctionRx getFunction();
/**
* Returns interface for Redis Function feature using provided codec
*
* @param codec - codec for params and result
* @return function interface
*/
RFunctionRx getFunction(Codec codec);
/**
* Returns keys operations.
* Each of Redis/Redisson object associated with own key
*
* @return Keys object
*/
RKeysRx getKeys();
/**
* Returns API for RediSearch module
*
* @return RSearchRx object
*/
RSearchRx getSearch();
/**
* Returns API for RediSearch module using defined codec for attribute values.
*
* @param codec codec for entry
* @return RSearchRx object
*/
RSearchRx getSearch(Codec codec);
/**
* Executes all operations accumulated during Reactive methods invocations Reactivehronously.
*
* In cluster configurations operations grouped by slot ids
* so may be executed on different servers. Thus command execution order could be changed
*
* @return List with result object for each command
*/
Maybe> execute();
/**
* Discard batched commands and release allocated buffers used for parameters encoding.
*
* @return void
*/
Completable discard();
}