Category: redis
-
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…
-
Working with Redis Increment and Decrement Commands using Redisson
In this section, we will explore how to work with increment and decrement operations in Redis using the Redisson Java client library. Until now, we have mostly been storing simple string values or Java objects in Redis. But Redis also supports numeric operations, allowing us to increment or decrement numeric values directly on the server…
-
Storing and Retrieving Java Objects in Redis
So far, we have learned how to store and retrieve simple key-value pairs (strings) in Redis using Redisson. In this tutorial, we’ll go one step further and explore how to store entire Java objects in Redis.This is an essential concept because, in real-world applications, we often work with structured data — not just plain strings.…
-
Setting and Managing Key Expiration in Redis
In this lecture, we will explore how to set an expiration time (or TTL — Time To Live) for a key in Redis. We will also see how to extend the expiry and how to retrieve the remaining lifetime of a key programmatically. 1. Setting Expiration for a Key So far, we have been creating…
-
Working with Redis Serialization and Codecs in Tests
In the previous lecture, we successfully created our first Redis test using a simple key-value pair. Hopefully, that exercise felt straightforward and intuitive. Now, before we move on, let’s explore something important related to how Redis stores and retrieves data — serialization and codecs. Understanding the Redis Documentation Redis provides excellent official documentation that covers…
-
Working with Simple Key-Value Pairs in Redis using Redisson (Reactive Mode)
In the previous tutorials, we successfully configured Redisson and created a reusable base test setup.Now, let’s move forward and interact with Redis by creating a simple key-value example using Redisson Reactive Client. This will help us understand how to store and retrieve basic data from Redis in a reactive, non-blocking way. 1. Objective In this…
-
Connecting to Redis Using Redisson in Java (Programmatic Configuration)
In this tutorial, we will learn how to create a Redis connection using Redisson, one of the most widely used Redis clients in the Java ecosystem.We will configure Redisson programmatically (without YAML or configuration files) and understand how to work in single-server mode. Later, you can easily extend this to master-slave or cluster modes. 1.…
