All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.redisson.api.RBatch Maven / Gradle / Ivy

Go to download

Easy Redis Java client and Real-Time Data Platform. Valkey compatible. Sync/Async/RxJava3/Reactive API. Client side caching. Over 50 Redis based Java objects and services: JCache API, Apache Tomcat, Hibernate, Spring, Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Bloom filter, Scheduler, RPC

There is a newer version: 3.40.2
Show newest version
/**
 * 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 org.redisson.client.RedisException;
import org.redisson.client.codec.Codec;
import org.redisson.codec.JsonCodec;

/**
 * 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 * */ public interface RBatch { /** * Returns stream instance by name * * @param type of key * @param type of value * @param name of stream * @return RStream object */ RStreamAsync getStream(String name); /** * Returns stream instance by name * using provided codec for entries. * * @param type of key * @param type of value * @param name - name of stream * @param codec - codec for entry * @return RStream object */ RStreamAsync getStream(String name, Codec codec); /** * Returns geospatial items holder instance by name. * * @param type of object * @param name - name of object * @return Geo object */ RGeoAsync 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 */ RGeoAsync 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 Multimap object */ RMultimapAsync 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 - provided codec * @return Multimap object */ RMultimapAsync getSetMultimap(String name, Codec codec); /** * 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 {@link #getSetMultimap(String)}.

* * @param type of key * @param type of value * @param name - name of object * @return SetMultimapCache object */ RMultimapCacheAsync getSetMultimapCache(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. * *

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

* * @param type of key * @param type of value * @param name - name of object * @param codec - provided codec * @return SetMultimapCache object */ RMultimapCacheAsync 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 */ RSetCacheAsync 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 */ RSetCacheAsync 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 */ RMapCacheAsync 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 */ RMapCacheAsync 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 */ RMapCacheNativeAsync 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 */ RMapCacheNativeAsync getMapCacheNative(String name, Codec codec); /** * Returns object holder by name * * @param type of object * @param name - name of object * @return Bucket object */ RBucketAsync getBucket(String name); RBucketAsync 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 */ RJsonBucketAsync getJsonBucket(String name, JsonCodec codec); /** * Returns HyperLogLog object * * @param type of object * @param name - name of object * @return HyperLogLog object */ RHyperLogLogAsync getHyperLogLog(String name); RHyperLogLogAsync getHyperLogLog(String name, Codec codec); /** * Returns list instance by name. * * @param type of object * @param name - name of object * @return List object */ RListAsync getList(String name); RListAsync 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 */ RMultimapAsync 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 */ RMultimapAsync getListMultimap(String name, Codec codec); /** * 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 {@link #getSetMultimap(String)}.

* * @param type of key * @param type of value * @param name - name of object * @return ListMultimapCache object */ RMultimapCacheAsync getListMultimapCache(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. * *

If eviction is not required then it's better to use regular map {@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 ListMultimapCache object */ RMultimapCacheAsync getListMultimapCache(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 */ RMultimapCacheAsync 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 */ RMultimapCacheAsync 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 */ RMultimapCacheAsync 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 */ RMultimapCacheAsync getSetMultimapCacheNative(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 */ RMapAsync getMap(String name); RMapAsync getMap(String name, Codec codec); /** * Returns set instance by name. * * @param type of value * @param name - name of object * @return Set object */ RSetAsync getSet(String name); RSetAsync getSet(String name, Codec codec); /** * Returns topic instance by name. * * @param name - name of object * @return Topic object */ RTopicAsync getTopic(String name); RTopicAsync 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 */ RShardedTopicAsync 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 */ RShardedTopicAsync getShardedTopic(String name, Codec codec); /** * Returns queue instance by name. * * @param type of value * @param name - name of object * @return Queue object */ RQueueAsync getQueue(String name); RQueueAsync getQueue(String name, Codec codec); /** * Returns blocking queue instance by name. * * @param type of value * @param name - name of object * @return BlockingQueue object */ RBlockingQueueAsync getBlockingQueue(String name); RBlockingQueueAsync getBlockingQueue(String name, Codec codec); /** * Returns deque instance by name. * * @param type of value * @param name - name of object * @return Deque object */ RDequeAsync getDeque(String name); RDequeAsync getDeque(String name, Codec codec); /** * Returns blocking deque instance by name. * * @param type of value * @param name - name of object * @return BlockingDeque object */ RBlockingDequeAsync getBlockingDeque(String name); RBlockingDequeAsync getBlockingDeque(String name, Codec codec); /** * Returns atomicLong instance by name. * * @param name - name of object * @return AtomicLong object */ RAtomicLongAsync getAtomicLong(String name); /** * Returns atomicDouble instance by name. * * @param name - name of object * @return AtomicDouble object */ RAtomicDoubleAsync getAtomicDouble(String name); /** * Returns Redis Sorted Set instance by name * * @param type of value * @param name - name of object * @return ScoredSortedSet object */ RScoredSortedSetAsync getScoredSortedSet(String name); RScoredSortedSetAsync 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 */ RLexSortedSetAsync getLexSortedSet(String name); /** * Returns bitSet instance by name. * * @param name - name of object * @return BitSet object */ RBitSetAsync getBitSet(String name); /** * Returns script operations object * * @return Script object */ RScriptAsync getScript(); /** * Returns script operations object using provided codec. * * @param codec - codec for params and result * @return Script object */ RScriptAsync getScript(Codec codec); /** * Returns interface for Redis Function feature * * @return function object */ RFunctionAsync getFunction(); /** * Returns interface for Redis Function feature using provided codec * * @param codec - codec for params and result * @return function interface */ RFunctionAsync getFunction(Codec codec); /** * Returns keys operations. * Each of Redis/Redisson object associated with own key * * @return Keys object */ RKeysAsync getKeys(); /** * Returns API for RediSearch module * * @return RSearchAsync object */ RSearchAsync getSearch(); /** * Returns API for RediSearch module using defined codec for attribute values. * * @param codec codec for entry * @return RSearchAsync object */ RSearchAsync getSearch(Codec codec); /** * 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 * * @return List with result object for each command * @throws RedisException in case of any error * */ BatchResult execute() throws RedisException; /** * 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 * * @return List with result object for each command */ RFuture> executeAsync(); /** * Discard batched commands and release allocated buffers used for parameters encoding. */ void discard(); /** * Discard batched commands and release allocated buffers used for parameters encoding. * * @return void */ RFuture discardAsync(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy