Author: Editorial Team
-
HyperLogLog in Java/Redis: Estimating Unique Counts Efficiently
In this lecture, we will explore HyperLogLog, a probabilistic data structure that is highly useful for counting unique elements in high-volume datasets without consuming a lot of memory. 1. Problem Scenario Imagine you are running a high-traffic application with multiple microservices. Some of the common business requirements might be: For business decisions, exact numbers are…
-
Using Redisson Lists as a Message Queue (Producer-Consumer Pattern)
Redisson supports reactive and blocking lists/deques, which can be leveraged to implement a message queue. This allows multiple producers and consumers to communicate asynchronously, similar to a microservice messaging system. In this tutorial, we will cover: 1. Setting Up the Message Queue We will use a blocking deque to simulate a message queue. Explanation: 2.…
-
Using Redisson Reactive Lists as Queue and Stack
Redisson provides reactive implementations of Redis data structures. While RListReactive behaves like a standard list, we can use additional methods to make it behave like a queue (FIFO) or stack (LIFO). This tutorial explains: 1. Setting Up the List Assume we already have a reactive list RListReactive<Long> with elements 1–10: 2. Making the List Behave…
-
Working with Reactive Lists in Redisson
Redisson provides reactive implementations for Redis data structures. Among them, RListReactive allows reactive interaction with Redis lists, enabling asynchronous operations, backpressure handling, and non-blocking I/O. This tutorial focuses on: 1. Setting Up a Reactive List First, you need a reactive Redisson client and a reactive list: Explanation: 2. Adding Elements Reactively Method 1: Using flatMap…
-
Using Redisson Local Cached Maps in Java
Redisson provides two primary ways to interact with Redis maps: This tutorial focuses on RLocalCachedMap, which is ideal for scenarios with multiple microservices or application instances that need fast local access and eventual consistency. 1. Overview of RLocalCachedMap RLocalCachedMap is a map where: Key Concepts 2. Creating a Local Cached Map Explanation: 3. Sink Strategies…
-
Expiring Individual Fields in Redis Hashes Using Redisson
Redis allows expiring entire keys, but individual fields in a hash cannot be expired by default. Redisson provides a solution through RMapCache, which supports per-field expiration. This is extremely useful when you want different fields in the same map to have different lifetimes. 1. Introduction to RMapCache RMapCache is an extension of RMap that provides:…
-
Storing and Updating Maps in Redis with Redisson
Previously, we focused on simple key-value pairs in Redis. Now, we will explore storing maps, updating fields, storing objects as values, and nested structures. 1. Basic Redis Map Setup Redis supports storing hashes (maps), which allows grouping multiple key-value pairs under a single Redis key. In Redisson, we use RMap. Verify in Redis CLI: Output:…
-
Redis Key Deletion Notifications
In the previous section, we learned how to receive key expiration notifications from Redis using the ExpiredObjectListener.Now, let’s explore another important feature — getting notified when a Redis key is explicitly deleted. Redis can trigger events not only when keys expire but also when they are manually deleted using commands such as DEL.With Redisson, we…
-
Redis Key Expiration Notifications Tutorial
In earlier lessons, we explored basic Redis operations — setting key-value pairs, incrementing and decrementing values, and even extending the lifetime of a key.However, we haven’t yet discussed one important aspect: how to get notified when a key expires in Redis. This tutorial focuses on exactly that — listening for Redis key expiration events using…
-
Working with Multiple Buckets in Redisson using getBuckets()
In previous lessons, we worked with simple Redis buckets to store and retrieve single key-value pairs.Now, let’s explore one of Redisson’s interesting features — the ability to retrieve multiple buckets at once and collect them into a single map. This is extremely useful when you need to fetch multiple keys from Redis in one network…
