Valkey and Redis Java client providing complete Real-Time Data Platform with distributed objects and services
npx @tessl/cli install tessl/maven-org-redisson--redisson@3.50.0Redisson is a Valkey and Redis Java client that provides a comprehensive Real-Time Data Platform with distributed objects and services. It offers in-memory data grid functionality with distributed collections, locks, synchronization primitives, and messaging capabilities, all with support for reactive programming models.
<dependency><groupId>org.redisson</groupId><artifactId>redisson</artifactId><version>3.50.0</version></dependency>import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.api.RedissonReactiveClient;
import org.redisson.api.RedissonRxClient;
import org.redisson.config.Config;import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.api.RMap;
import org.redisson.api.RLock;
import org.redisson.config.Config;
// Create client with default configuration
RedissonClient redisson = Redisson.create();
// Create client with custom configuration
Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
RedissonClient redisson = Redisson.create(config);
// Use distributed map
RMap<String, String> map = redisson.getMap("myMap");
map.put("key1", "value1");
String value = map.get("key1");
// Use distributed lock
RLock lock = redisson.getLock("myLock");
lock.lock();
try {
// Protected code
} finally {
lock.unlock();
}
// Cleanup
redisson.shutdown();Redisson is built around several key components:
Redisson class provides factory methods for creating different client typesRedissonClient (sync), RedissonReactiveClient (reactive), RedissonRxClient (RxJava)Config class with various server configuration modes (single, cluster, sentinel, etc.)Core client factory methods and configuration options for connecting to Redis servers in various deployment modes.
// Factory methods
public static RedissonClient create();
public static RedissonClient create(Config config);
// Reactive client access
public RedissonReactiveClient reactive();
public RedissonRxClient rxJava();Configuration and Client Setup
Distributed implementations of standard Java collections including maps, lists, sets, queues, and specialized collections with Redis persistence.
// Maps and caches
public <K, V> RMap<K, V> getMap(String name);
public <K, V> RMapCache<K, V> getMapCache(String name);
public <K, V> RLocalCachedMap<K, V> getLocalCachedMap(LocalCachedMapOptions<K, V> options);
// Lists and sequences
public <V> RList<V> getList(String name);
// Sets and sorted sets
public <V> RSet<V> getSet(String name);
public <V> RSortedSet<V> getSortedSet(String name);
public <V> RScoredSortedSet<V> getScoredSortedSet(String name);
public RLexSortedSet getLexSortedSet(String name);
// Queues and deques
public <V> RQueue<V> getQueue(String name);
public <V> RBlockingQueue<V> getBlockingQueue(String name);
public <V> RDeque<V> getDeque(String name);
public <V> RPriorityQueue<V> getPriorityQueue(String name);
// Multimaps
public <K, V> RListMultimap<K, V> getListMultimap(String name);
public <K, V> RSetMultimap<K, V> getSetMultimap(String name);Distributed locking and synchronization primitives for coordinating access across multiple JVM instances.
// Locks
public RLock getLock(String name);
public RLock getFairLock(String name);
public RLock getSpinLock(String name);
public RFencedLock getFencedLock(String name);
public RReadWriteLock getReadWriteLock(String name);
// Multi-locks
public RLock getMultiLock(RLock... locks);
// Synchronization primitives
public RSemaphore getSemaphore(String name);
public RPermitExpirableSemaphore getPermitExpirableSemaphore(String name);
public RCountDownLatch getCountDownLatch(String name);Non-blocking reactive programming support with Reactive Streams and RxJava interfaces for all distributed objects.
// Reactive client interface
public interface RedissonReactiveClient {
<K, V> RMapReactive<K, V> getMap(String name);
RLockReactive getLock(String name);
}
// RxJava client interface
public interface RedissonRxClient {
<K, V> RMapRx<K, V> getMap(String name);
RLockRx getLock(String name);
}Publish/subscribe messaging system with pattern matching, sharding, and reliable delivery options.
// Topics
public RTopic getTopic(String name);
public RPatternTopic getPatternTopic(String pattern);
public RShardedTopic getShardedTopic(String name);
public RReliableTopic getReliableTopic(String name);Advanced data structures including atomic values, probabilistic structures, geospatial operations, time series, streams, and utility objects.
// Atomic values
public RAtomicLong getAtomicLong(String name);
public RAtomicDouble getAtomicDouble(String name);
public RLongAdder getLongAdder(String name);
public RDoubleAdder getDoubleAdder(String name);
// Probabilistic structures
public <V> RBloomFilter<V> getBloomFilter(String name);
public <V> RHyperLogLog<V> getHyperLogLog(String name);
// Geospatial and binary operations
public <V> RGeo<V> getGeo(String name);
public RBitSet getBitSet(String name);
// Time series and streams (Redis 5.0.0+)
public <V, L> RTimeSeries<V, L> getTimeSeries(String name);
public <K, V> RStream<K, V> getStream(String name);
// Utility structures
public RIdGenerator getIdGenerator(String name);
public RRateLimiter getRateLimiter(String name);
// Data holders
public <V> RBucket<V> getBucket(String name);
public <V> RJsonBucket<V> getJsonBucket(JsonBucketOptions<V> options);Enterprise-grade services for search, scripting, remote procedure calls, and distributed computing.
// Search capabilities (RediSearch module)
public RSearch getSearch();
// Script and function execution
public RScript getScript();
public RFunction getFunction();
// Remote services and executors
public RRemoteService getRemoteService(String name);
public RScheduledExecutorService getExecutorService(String name);
// Live object service
public RLiveObjectService getLiveObjectService();
// Transactions and batching
public RTransaction createTransaction(TransactionOptions options);
public RBatch createBatch(BatchOptions options);// Main client interface
public interface RedissonClient {
Config getConfig();
void shutdown();
void shutdown(long quietPeriod, long timeout, TimeUnit unit);
boolean isShutdown();
boolean isShuttingDown();
String getId();
}
// Base object interface
public interface RObject {
String getName();
Codec getCodec();
}
// Expirable object interface
public interface RExpirable extends RExpirableAsync {
boolean expire(long timeToLive, TimeUnit timeUnit);
boolean expireAt(long timestamp);
boolean expireAt(Date timestamp);
boolean clearExpire();
long remainTimeToLive();
long getExpireTime();
}
// Async operations interface
public interface RObjectAsync {
RFuture<Boolean> touchAsync();
RFuture<Boolean> unlinkAsync();
RFuture<Boolean> deleteAsync();
RFuture<Boolean> isExistsAsync();
}