
org.redisson.api.RBatchReactive Maven / Gradle / Ivy
/**
* Copyright 2016 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 java.util.concurrent.TimeUnit;
import org.reactivestreams.Publisher;
import org.redisson.client.codec.Codec;
/**
* Interface for using 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 RBatchReactive {
/**
* 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
*/
RSetCacheReactive 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
*/
RSetCacheReactive 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
*/
RMapCacheReactive 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
*/
RMapCacheReactive getMapCache(String name);
/**
* Returns object holder by name
*
* @param type of value
* @param name - name of object
* @return Bucket object
*/
RBucketReactive getBucket(String name);
RBucketReactive getBucket(String name, Codec codec);
/**
* Returns HyperLogLog object by name
*
* @param type of value
* @param name - name of object
* @return HyperLogLog object
*/
RHyperLogLogReactive getHyperLogLog(String name);
RHyperLogLogReactive getHyperLogLog(String name, Codec codec);
/**
* Returns list instance by name.
*
* @param type of value
* @param name - name of object
* @return List object
*/
RListReactive getList(String name);
RListReactive getList(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
*/
RMapReactive getMap(String name);
RMapReactive getMap(String name, Codec codec);
/**
* Returns set instance by name.
*
* @param type of value
* @param name - name of object
* @return Set object
*/
RSetReactive getSet(String name);
RSetReactive getSet(String name, Codec codec);
/**
* Returns topic instance by name.
*
* @param type of message
* @param name - name of object
* @return Topic object
*/
RTopicReactive getTopic(String name);
RTopicReactive getTopic(String name, Codec codec);
/**
* Returns queue instance by name.
*
* @param type of value
* @param name - name of object
* @return Queue object
*/
RQueueReactive getQueue(String name);
RQueueReactive getQueue(String name, Codec codec);
/**
* Returns blocking queue instance by name.
*
* @param type of value
* @param name - name of object
* @return BlockingQueue object
*/
RBlockingQueueReactive getBlockingQueue(String name);
RBlockingQueueReactive getBlockingQueue(String name, Codec codec);
/**
* Returns deque instance by name.
*
* @param type of value
* @param name - name of object
* @return Deque object
*/
RDequeReactive getDequeReactive(String name);
RDequeReactive getDequeReactive(String name, Codec codec);
/**
* Returns "atomic long" instance by name.
*
* @param name - name of object
* @return AtomicLong object
*/
RAtomicLongReactive getAtomicLongReactive(String name);
/**
* Returns Redis Sorted Set instance by name
*
* @param type of value
* @param name - name of object
* @return ScoredSortedSet object
*/
RScoredSortedSetReactive getScoredSortedSet(String name);
RScoredSortedSetReactive 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
*/
RLexSortedSetReactive getLexSortedSet(String name);
/**
* Returns bitSet instance by name.
*
* @param name of bitSet
* @return BitSet object
*/
RBitSetReactive getBitSet(String name);
/**
* Returns script operations object
*
* @return Script object
*/
RScriptReactive getScript();
/**
* Returns keys operations.
* Each of Redis/Redisson object associated with own key
*
* @return Keys object
*/
RKeysReactive getKeys();
/**
* 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
*/
Publisher> execute();
/**
* Command replies are skipped such approach saves response bandwidth.
*
* NOTE: Redis 3.2+ required
*
* @return self instance
*/
RBatchReactive skipResult();
/**
*
*
* NOTE: Redis 3.0+ required
*
* @param slaves number to sync
* @param timeout for sync operation
* @param unit value
* @return self instance
*/
RBatchReactive syncSlaves(int slaves, long timeout, TimeUnit unit);
/**
* Defines timeout for Redis response.
* Starts to countdown when Redis command has been successfully sent.
*
* 0
value means use Config.setTimeout
value instead.
*
* Default is 0
*
* @param timeout value
* @param unit value
* @return self instance
*/
RBatchReactive timeout(long timeout, TimeUnit unit);
/**
* Defines time interval for another one attempt send Redis commands batch
* if it hasn't been sent already.
*
* 0
value means use Config.setRetryInterval
value instead.
*
* Default is 0
*
* @param retryInterval value
* @param unit value
* @return self instance
*/
RBatchReactive retryInterval(long retryInterval, TimeUnit unit);
/**
* Defines attempts amount to re-send Redis commands batch
* if it hasn't been sent already.
*
* 0
value means use Config.setRetryAttempts
value instead.
*
* Default is 0
*
* @param retryAttempts value
* @return self instance
*/
RBatchReactive retryAttempts(int retryAttempts);
}