Add Expiration-based API for SET command operations.#3305
Closed
Dgramada wants to merge 5 commits intospring-projects:mainfrom
Closed
Add Expiration-based API for SET command operations.#3305Dgramada wants to merge 5 commits intospring-projects:mainfrom
Dgramada wants to merge 5 commits intospring-projects:mainfrom
Conversation
Introduce new methods accepting Expiration instead of Duration/TimeUnit for set, setGet, setIfAbsent, and setIfPresent operations across ValueOperations, BoundValueOperations, and ReactiveValueOperations. Deprecate existing Duration and TimeUnit-based methods in favor of the new Expiration-based variants. Fix LettuceReactiveStringCommands.setGet() to properly apply expiration and set options which were previously being ignored. Add Kotlin coroutine extension functions for reactive Expiration variants. Signed-off-by: Yordan Tsintsov <yordan.tsintsov@redis.com>
Signed-off-by: Yordan Tsintsov <yordan.tsintsov@redis.com>
…o call Expiration set method instead of TimeUnit set method. Signed-off-by: Yordan Tsintsov <yordan.tsintsov@redis.com>
…methods. Signed-off-by: Yordan Tsintsov <yordan.tsintsov@redis.com>
onobc
requested changes
Feb 5, 2026
Contributor
onobc
left a comment
There was a problem hiding this comment.
@Dgramada this is looking good. I am in the middle of the review but I wanted to drop my current feedback before I drop off for the day so we can timezone surf...
- Please add yourself as
@ authorwhere applicable - I think we should also deprecate the
Durationvariants as they suffer the same limitations asTimeUnit. - Inline comment around the included bug fix
Looking good. Thank you.
...in/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java
Show resolved
Hide resolved
Signed-off-by: Yordan Tsintsov <yordan.tsintsov@redis.com>
onobc
added a commit
that referenced
this pull request
Feb 6, 2026
Removes redundant `expiration` from Javadocs. Original Pull Request #3305
Contributor
|
Thank for another excellent contribution @Dgramada ! |
tishun
pushed a commit
to tishun/spring-data-redis
that referenced
this pull request
Feb 18, 2026
Introduces new methods accepting Expiration (instead of Duration/TimeUnit) for set, setGet, setIfAbsent, and setIfPresent operations across ValueOperations, BoundValueOperations, and ReactiveValueOperations. Deprecates existing TimeUnit-based methods in favor of the new Expiration-based variants. Fixes LettuceReactiveStringCommands.setGet() to properly apply expiration and set options which were previously being ignored. Adds Kotlin coroutine extension functions for reactive Expiration variants. Refactors default interface implementation of Duration set methods to call Expiration set method instead of TimeUnit set method. Closes spring-projects#3305 Signed-off-by: Yordan Tsintsov <yordan.tsintsov@redis.com> Signed-off-by: Tihomir Mateev <tihomir.mateev@redis.com>
tishun
pushed a commit
to tishun/spring-data-redis
that referenced
this pull request
Feb 18, 2026
Removes redundant `expiration` from Javadocs. Original Pull Request spring-projects#3305 Signed-off-by: Tihomir Mateev <tihomir.mateev@redis.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces
Expiration-based API methods for SET command operations, replacing the existingTimeUnitvariants.Motivation
The current API using
TimeUnitcannot express advanced Redis SET options:The
Expirationclass already supports these features at the connection layer, but they were not accessible through the template API.Changes
New Methods (with
@since 4.1)ValueOperations:set,setGet,setIfAbsent,setIfPresentwithExpirationBoundValueOperations:set,setGet,setIfAbsent,setIfPresentwithExpirationReactiveValueOperations:set,setGet,setIfAbsent,setIfPresentwithExpirationDeprecated Methods
TimeUnitvariants marked with@Deprecated(since = "4.1", forRemoval = true)Bug Fix
LettuceReactiveStringCommands.setGet()which was ignoring expiration and set options (pre-existing bug since 3.5)Kotlin Extensions
ExpirationvariantsTesting