org.redisson.RedissonBatch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of redisson-all Show documentation
Show all versions of redisson-all Show documentation
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
The 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;
import org.redisson.api.*;
import org.redisson.client.codec.Codec;
import org.redisson.codec.JsonCodec;
import org.redisson.command.CommandAsyncExecutor;
import org.redisson.command.CommandBatchService;
import org.redisson.eviction.EvictionScheduler;
/**
*
*
* @author Nikita Koksharov
*
*/
public class RedissonBatch implements RBatch {
private final EvictionScheduler evictionScheduler;
private final CommandBatchService executorService;
public RedissonBatch(EvictionScheduler evictionScheduler, CommandAsyncExecutor executor, BatchOptions options) {
this.executorService = executor.createCommandBatchService(options);
this.evictionScheduler = evictionScheduler;
}
@Override
public RBucketAsync getBucket(String name) {
return new RedissonBucket(executorService, name);
}
@Override
public RBucketAsync getBucket(String name, Codec codec) {
return new RedissonBucket(codec, executorService, name);
}
@Override
public RJsonBucketAsync getJsonBucket(String name, JsonCodec codec) {
return new RedissonJsonBucket<>(codec, executorService, name);
}
@Override
public RHyperLogLogAsync getHyperLogLog(String name) {
return new RedissonHyperLogLog(executorService, name);
}
@Override
public RHyperLogLogAsync getHyperLogLog(String name, Codec codec) {
return new RedissonHyperLogLog(codec, executorService, name);
}
@Override
public RListAsync getList(String name) {
return new RedissonList(executorService, name, null);
}
@Override
public RListAsync getList(String name, Codec codec) {
return new RedissonList(codec, executorService, name, null);
}
@Override
public RMapAsync getMap(String name) {
return new RedissonMap(executorService, name, null, null, null);
}
@Override
public RMapAsync getMap(String name, Codec codec) {
return new RedissonMap(codec, executorService, name, null, null, null);
}
@Override
public RSetAsync getSet(String name) {
return new RedissonSet(executorService, name, null);
}
@Override
public RSetAsync getSet(String name, Codec codec) {
return new RedissonSet(codec, executorService, name, null);
}
@Override
public RTopicAsync getTopic(String name) {
return new RedissonTopic(executorService, name);
}
@Override
public RTopicAsync getTopic(String name, Codec codec) {
return new RedissonTopic(codec, executorService, name);
}
@Override
public RShardedTopicAsync getShardedTopic(String name) {
return new RedissonShardedTopic(executorService, name);
}
@Override
public RShardedTopicAsync getShardedTopic(String name, Codec codec) {
return new RedissonShardedTopic(codec, executorService, name);
}
@Override
public RQueueAsync getQueue(String name) {
return new RedissonQueue(executorService, name, null);
}
@Override
public RQueueAsync getQueue(String name, Codec codec) {
return new RedissonQueue(codec, executorService, name, null);
}
@Override
public RBlockingQueueAsync getBlockingQueue(String name) {
return new RedissonBlockingQueue(executorService, name, null);
}
@Override
public RBlockingQueueAsync getBlockingQueue(String name, Codec codec) {
return new RedissonBlockingQueue(codec, executorService, name, null);
}
@Override
public RBlockingDequeAsync getBlockingDeque(String name) {
return new RedissonBlockingDeque(executorService, name, null);
}
@Override
public RBlockingDequeAsync getBlockingDeque(String name, Codec codec) {
return new RedissonBlockingDeque(codec, executorService, name, null);
}
@Override
public RDequeAsync getDeque(String name) {
return new RedissonDeque(executorService, name, null);
}
@Override
public RDequeAsync getDeque(String name, Codec codec) {
return new RedissonDeque(codec, executorService, name, null);
}
@Override
public RAtomicLongAsync getAtomicLong(String name) {
return new RedissonAtomicLong(executorService, name);
}
@Override
public RAtomicDoubleAsync getAtomicDouble(String name) {
return new RedissonAtomicDouble(executorService, name);
}
@Override
public RScoredSortedSetAsync getScoredSortedSet(String name) {
return new RedissonScoredSortedSet(executorService, name, null);
}
@Override
public RScoredSortedSetAsync getScoredSortedSet(String name, Codec codec) {
return new RedissonScoredSortedSet(codec, executorService, name, null);
}
@Override
public RLexSortedSetAsync getLexSortedSet(String name) {
return new RedissonLexSortedSet(executorService, name, null);
}
@Override
public RBitSetAsync getBitSet(String name) {
return new RedissonBitSet(executorService, name);
}
@Override
public RMapCacheAsync getMapCache(String name, Codec codec) {
return new RedissonMapCache(codec, evictionScheduler, executorService, name, null, null, null);
}
@Override
public RMapCacheAsync getMapCache(String name) {
return new RedissonMapCache(evictionScheduler, executorService, name, null, null, null);
}
@Override
public RMapCacheNativeAsync getMapCacheNative(String name) {
return new RedissonMapCacheNative<>(executorService, name, null, null, null);
}
@Override
public RMapCacheNativeAsync getMapCacheNative(String name, Codec codec) {
return new RedissonMapCacheNative<>(codec, executorService, name, null, null, null);
}
@Override
public RScriptAsync getScript() {
return new RedissonScript(executorService);
}
@Override
public RScriptAsync getScript(Codec codec) {
return new RedissonScript(executorService, codec);
}
@Override
public RFunctionAsync getFunction() {
return new RedissonFuction(executorService);
}
@Override
public RFunctionAsync getFunction(Codec codec) {
return new RedissonFuction(executorService, codec);
}
@Override
public RKeysAsync getKeys() {
return new RedissonKeys(executorService);
}
@Override
public RSearchAsync getSearch() {
return new RedissonSearch(executorService);
}
@Override
public RSearchAsync getSearch(Codec codec) {
return new RedissonSearch(codec, executorService);
}
@Override
public RSetCacheAsync getSetCache(String name) {
return new RedissonSetCache(evictionScheduler, executorService, name, null);
}
@Override
public RSetCacheAsync getSetCache(String name, Codec codec) {
return new RedissonSetCache(codec, evictionScheduler, executorService, name, null);
}
@Override
public BatchResult> execute() {
return executorService.execute();
}
@Override
public RFuture> executeAsync() {
return executorService.executeAsync();
}
@Override
public void discard() {
executorService.discard();
}
@Override
public RFuture discardAsync() {
return executorService.discardAsync();
}
@Override
public RMultimapAsync getSetMultimap(String name) {
return new RedissonSetMultimap(executorService, name);
}
@Override
public RMultimapAsync getSetMultimap(String name, Codec codec) {
return new RedissonSetMultimap(codec, executorService, name);
}
@Override
public RMultimapAsync getListMultimap(String name) {
return new RedissonListMultimap(executorService, name);
}
@Override
public RMultimapAsync getListMultimap(String name, Codec codec) {
return new RedissonListMultimap(codec, executorService, name);
}
@Override
public RGeoAsync getGeo(String name) {
return new RedissonGeo(executorService, name, null);
}
@Override
public RGeoAsync getGeo(String name, Codec codec) {
return new RedissonGeo(codec, executorService, name, null);
}
@Override
public RMultimapCacheAsync getSetMultimapCache(String name) {
return new RedissonSetMultimapCache(evictionScheduler, executorService, name);
}
@Override
public RMultimapCacheAsync getSetMultimapCache(String name, Codec codec) {
return new RedissonSetMultimapCache(evictionScheduler, codec, executorService, name);
}
@Override
public RMultimapCacheAsync getListMultimapCache(String name) {
return new RedissonListMultimapCache<>(evictionScheduler, executorService, name);
}
@Override
public RMultimapCacheAsync getListMultimapCache(String name, Codec codec) {
return new RedissonListMultimapCache<>(evictionScheduler, codec, executorService, name);
}
@Override
public RMultimapCacheAsync getListMultimapCacheNative(String name) {
return new RedissonListMultimapCacheNative<>(executorService, name);
}
@Override
public RMultimapCacheAsync getListMultimapCacheNative(String name, Codec codec) {
return new RedissonListMultimapCacheNative<>(codec, executorService, name);
}
@Override
public RMultimapCacheAsync getSetMultimapCacheNative(String name) {
return new RedissonSetMultimapCacheNative<>(executorService, name);
}
@Override
public RMultimapCacheAsync getSetMultimapCacheNative(String name, Codec codec) {
return new RedissonSetMultimapCacheNative<>(codec, executorService, name);
}
@Override
public RStreamAsync getStream(String name) {
return new RedissonStream(executorService, name);
}
@Override
public RStreamAsync getStream(String name, Codec codec) {
return new RedissonStream(codec, executorService, name);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy