Convert Figma logo to code with AI

redisson logoredisson

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

23,277
5,343
23,277
399

Top Related Projects

5,381

Advanced Java Redis client for thread-safe sync, async, and reactive usage. Supports Cluster, Sentinel, Pipelining, and codecs.

11,829

Redis Java client

Provides support to increase developer productivity in Java when using Redis, a key-value store. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.

9,077

Main Portal page for the Jackson project

33,371

Netty project - an event-driven asynchronous network application framework

Quick Overview

Redisson is a Redis client for Java with features for distributed objects and services. It offers a wide range of distributed Java objects and services, such as distributed collections, locks, and publish/subscribe messaging, all built on top of Redis. Redisson simplifies the development of distributed applications by providing a high-level API for Redis operations.

Pros

  • Extensive set of distributed Java objects and services
  • High-performance and thread-safe implementation
  • Supports various Redis deployment models (single, sentinel, cluster)
  • Automatic reconnection and retry mechanisms

Cons

  • Steeper learning curve compared to simpler Redis clients
  • Potential overhead for simple use cases
  • Dependency on Redis for all operations
  • Limited support for non-JVM languages

Code Examples

  1. Creating a distributed Map:
RMap<String, String> map = redisson.getMap("myMap");
map.put("key", "value");
String value = map.get("key");
  1. Using a distributed Lock:
RLock lock = redisson.getLock("myLock");
lock.lock();
try {
    // perform locked operations
} finally {
    lock.unlock();
}
  1. Publish/Subscribe messaging:
RTopic topic = redisson.getTopic("myTopic");
topic.addListener(String.class, (channel, message) -> {
    System.out.println("Message received: " + message);
});
topic.publish("Hello, Redisson!");

Getting Started

To start using Redisson in your Java project:

  1. Add the Redisson dependency to your project's pom.xml (for Maven):
<dependency>
    <groupId>org.redisson</groupId>
    <artifactId>redisson</artifactId>
    <version>3.17.0</version>
</dependency>
  1. Create a Redisson client instance:
Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
RedissonClient redisson = Redisson.create(config);
  1. Use Redisson objects and services in your application:
RMap<String, String> map = redisson.getMap("myMap");
map.put("key", "value");
  1. Don't forget to shut down the Redisson client when you're done:
redisson.shutdown();

Competitor Comparisons

5,381

Advanced Java Redis client for thread-safe sync, async, and reactive usage. Supports Cluster, Sentinel, Pipelining, and codecs.

Pros of Lettuce

  • Lightweight and non-blocking, built on Netty for high performance
  • Extensive support for Redis Cluster and Sentinel
  • Comprehensive documentation and active community support

Cons of Lettuce

  • Steeper learning curve, especially for developers new to reactive programming
  • Less built-in support for distributed Java objects compared to Redisson
  • Fewer high-level constructs and abstractions for complex Redis operations

Code Comparison

Lettuce:

RedisClient redisClient = RedisClient.create("redis://localhost:6379");
StatefulRedisConnection<String, String> connection = redisClient.connect();
RedisCommands<String, String> syncCommands = connection.sync();
syncCommands.set("key", "Hello, Redis!");

Redisson:

Config config = new Config();
config.useSingleServer().setAddress("redis://localhost:6379");
RedissonClient redisson = Redisson.create(config);
RBucket<String> bucket = redisson.getBucket("key");
bucket.set("Hello, Redis!");

Both libraries offer efficient ways to interact with Redis, but Redisson provides a more abstracted API with built-in support for distributed objects, while Lettuce offers a lower-level, highly performant approach with reactive programming capabilities.

11,829

Redis Java client

Pros of Jedis

  • Lightweight and simple API, making it easy to learn and use
  • Faster performance for basic operations due to its simplicity
  • Widely adopted and well-established in the Redis community

Cons of Jedis

  • Limited support for advanced Redis features and data structures
  • Lacks built-in connection pooling, requiring additional configuration
  • Less comprehensive documentation compared to Redisson

Code Comparison

Jedis:

Jedis jedis = new Jedis("localhost");
jedis.set("key", "value");
String value = jedis.get("key");
jedis.close();

Redisson:

RedissonClient redisson = Redisson.create();
RBucket<String> bucket = redisson.getBucket("key");
bucket.set("value");
String value = bucket.get();
redisson.shutdown();

The code examples demonstrate the basic usage of both libraries for setting and getting a key-value pair. Jedis uses a more straightforward approach with direct method calls, while Redisson utilizes distributed objects and provides a more object-oriented interface.

Redisson offers a wider range of features and abstractions, making it suitable for complex Redis operations and distributed systems. However, Jedis remains a popular choice for simpler use cases and projects that prioritize performance for basic operations.

Provides support to increase developer productivity in Java when using Redis, a key-value store. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.

Pros of Spring Data Redis

  • Seamless integration with Spring ecosystem
  • Extensive documentation and community support
  • Abstraction layer for multiple Redis clients (Lettuce, Jedis)

Cons of Spring Data Redis

  • Steeper learning curve for non-Spring users
  • Less feature-rich compared to Redisson's advanced functionalities
  • Potentially slower performance due to abstraction layer

Code Comparison

Spring Data Redis:

@Repository
public interface UserRepository extends CrudRepository<User, String> {
    User findByUsername(String username);
}

Redisson:

RMap<String, User> map = redisson.getMap("users");
User user = map.get("username");

Spring Data Redis provides a higher-level abstraction with repository interfaces, while Redisson offers more direct access to Redis data structures. Spring Data Redis is ideal for Spring-based applications, whereas Redisson provides a more flexible and feature-rich approach for Redis interactions across various Java frameworks.

Both libraries have their strengths, and the choice depends on the specific project requirements, existing technology stack, and developer preferences. Spring Data Redis excels in Spring environments, while Redisson offers more advanced Redis features and better performance in non-Spring contexts.

9,077

Main Portal page for the Jackson project

Pros of Jackson

  • Widely adopted and well-established JSON processing library for Java
  • Extensive support for various data formats beyond JSON (XML, YAML, CSV, etc.)
  • Highly customizable with a rich ecosystem of modules and extensions

Cons of Jackson

  • Steeper learning curve due to its extensive feature set
  • Can be overkill for simple JSON processing tasks
  • May require additional configuration for complex use cases

Code Comparison

Jackson (JSON parsing):

ObjectMapper mapper = new ObjectMapper();
MyObject obj = mapper.readValue(jsonString, MyObject.class);

Redisson (Redis operations):

RedissonClient redisson = Redisson.create();
RMap<String, String> map = redisson.getMap("myMap");
map.put("key", "value");

Key Differences

  • Jackson focuses on data serialization/deserialization, while Redisson is a Redis client
  • Redisson provides distributed Java objects and services, whereas Jackson is primarily for data processing
  • Jackson is more versatile for general data handling, while Redisson specializes in Redis-based operations

Both libraries serve different purposes and can be complementary in a Java ecosystem. Jackson excels at data transformation, while Redisson offers robust Redis integration and distributed computing features.

33,371

Netty project - an event-driven asynchronous network application framework

Pros of Netty

  • Lower-level networking framework offering more flexibility and control
  • Broader application scope beyond Redis, suitable for various network protocols
  • Larger community and ecosystem with extensive documentation

Cons of Netty

  • Steeper learning curve due to its low-level nature
  • Requires more boilerplate code for basic functionality
  • Less specialized for Redis operations compared to Redisson

Code Comparison

Netty (basic server setup):

EventLoopGroup bossGroup = new NioEventLoopGroup();
EventLoopGroup workerGroup = new NioEventLoopGroup();
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup)
 .channel(NioServerSocketChannel.class)

Redisson (Redis connection):

Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379");
RedissonClient redisson = Redisson.create(config);
RMap<String, String> map = redisson.getMap("myMap");

Netty provides a more general-purpose networking framework, while Redisson offers a higher-level abstraction specifically for Redis operations. Netty requires more setup but offers greater flexibility, whereas Redisson simplifies Redis interactions with a more focused API.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Redisson - Easy Redis Java client
and Real-Time Data Platform

Maven Central JavaDoc License

Quick start | Documentation | Changelog | Code examples | Report an issue

High-performance async and lock-free Java client for Redis and Valkey based on Netty framework.

Features

Comparing solutions

Success stories

Upgrade to Redisson PRO with advanced features.