From 6d4cc4dd2f59af00fdcad431d875ffe848f4dfb0 Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Thu, 17 Feb 2022 12:28:08 +0300 Subject: [PATCH] refactoring --- .../java/org/redisson/api/RExpirableReactive.java | 13 +++++++++++-- .../main/java/org/redisson/api/RExpirableRx.java | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/redisson/src/main/java/org/redisson/api/RExpirableReactive.java b/redisson/src/main/java/org/redisson/api/RExpirableReactive.java index 280500f93..5ec1922c4 100644 --- a/redisson/src/main/java/org/redisson/api/RExpirableReactive.java +++ b/redisson/src/main/java/org/redisson/api/RExpirableReactive.java @@ -32,13 +32,13 @@ import reactor.core.publisher.Mono; public interface RExpirableReactive extends RObjectReactive { /** - * Set a timeout for object in mode. After the timeout has expired, - * the key will automatically be deleted. + * Use {@link #expire(Duration)} instead * * @param timeToLive - timeout before object will be deleted * @param timeUnit - timeout time unit * @return true if the timeout was set and false if not */ + @Deprecated Mono expire(long timeToLive, TimeUnit timeUnit); /** @@ -112,6 +112,15 @@ public interface RExpirableReactive extends RObjectReactive { */ Mono expireIfLess(Instant time); + /** + * Sets a timeout for this object. After the timeout has expired, + * the key will automatically be deleted. + * + * @param duration timeout before object will be deleted + * @return true if the timeout was set and false if not + */ + Mono expire(Duration duration); + /** * Sets a timeout for this object only if it has been already set. * After the timeout has expired, the key will automatically be deleted. diff --git a/redisson/src/main/java/org/redisson/api/RExpirableRx.java b/redisson/src/main/java/org/redisson/api/RExpirableRx.java index de100a7b5..2e9c7ab7c 100644 --- a/redisson/src/main/java/org/redisson/api/RExpirableRx.java +++ b/redisson/src/main/java/org/redisson/api/RExpirableRx.java @@ -32,13 +32,13 @@ import io.reactivex.rxjava3.core.Single; public interface RExpirableRx extends RObjectRx { /** - * Set a timeout for object in mode. After the timeout has expired, - * the key will automatically be deleted. + * Use {@link #expire(Duration)} instead * * @param timeToLive - timeout before object will be deleted * @param timeUnit - timeout time unit * @return true if the timeout was set and false if not */ + @Deprecated Single expire(long timeToLive, TimeUnit timeUnit); /** @@ -112,6 +112,15 @@ public interface RExpirableRx extends RObjectRx { */ Single expireIfLess(Instant time); + /** + * Sets a timeout for this object. After the timeout has expired, + * the key will automatically be deleted. + * + * @param duration timeout before object will be deleted + * @return true if the timeout was set and false if not + */ + Single expire(Duration duration); + /** * Sets a timeout for this object only if it has been already set. * After the timeout has expired, the key will automatically be deleted.