Polishing.
Rename builder for ExpirationOptions, remove unused import and update javadoc. Original Pull Request: #3115
This commit is contained in:
@@ -46,8 +46,8 @@ public class ExpirationOptions {
|
||||
/**
|
||||
* @return builder for creating {@code FieldExpireOptionsBuilder}.
|
||||
*/
|
||||
public static FieldExpireOptionsBuilder builder() {
|
||||
return new FieldExpireOptionsBuilder();
|
||||
public static ExpirationOptionsBuilder builder() {
|
||||
return new ExpirationOptionsBuilder();
|
||||
}
|
||||
|
||||
public Condition getCondition() {
|
||||
@@ -74,32 +74,44 @@ public class ExpirationOptions {
|
||||
/**
|
||||
* Builder to build {@link ExpirationOptions}
|
||||
*/
|
||||
public static class FieldExpireOptionsBuilder {
|
||||
public static class ExpirationOptionsBuilder {
|
||||
|
||||
private Condition condition = Condition.ALWAYS;
|
||||
|
||||
private FieldExpireOptionsBuilder() {}
|
||||
private ExpirationOptionsBuilder() {}
|
||||
|
||||
/**
|
||||
* Apply to fields that have no expiration.
|
||||
*/
|
||||
@Contract("-> this")
|
||||
public FieldExpireOptionsBuilder nx() {
|
||||
public ExpirationOptionsBuilder nx() {
|
||||
this.condition = Condition.NX;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply to fields that have an existing expiration.
|
||||
*/
|
||||
@Contract("-> this")
|
||||
public FieldExpireOptionsBuilder xx() {
|
||||
public ExpirationOptionsBuilder xx() {
|
||||
this.condition = Condition.XX;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply to fields when the new expiration is greater than the current one.
|
||||
*/
|
||||
@Contract("-> this")
|
||||
public FieldExpireOptionsBuilder gt() {
|
||||
public ExpirationOptionsBuilder gt() {
|
||||
this.condition = Condition.GT;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply to fields when the new expiration is lower than the current one.
|
||||
*/
|
||||
@Contract("-> this")
|
||||
public FieldExpireOptionsBuilder lt() {
|
||||
public ExpirationOptionsBuilder lt() {
|
||||
this.condition = Condition.LT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ public interface ReactiveRedisOperations<K, V> {
|
||||
* @param key must not be {@literal null}.
|
||||
* @param expiration must not be {@literal null}.
|
||||
* @param options must not be {@literal null}.
|
||||
* @throws IllegalArgumentException if the instant is {@literal null} or too large to represent as a {@code Date}.
|
||||
* @throws IllegalArgumentException any of required arguments is {@literal null}.
|
||||
* @see <a href="https://redis.io/commands/expire">Redis Documentation: EXPIRE</a>
|
||||
* @see <a href="https://redis.io/commands/pexpire">Redis Documentation: PEXPIRE</a>
|
||||
* @see <a href="https://redis.io/commands/expireat">Redis Documentation: EXPIREAT</a>
|
||||
|
||||
@@ -375,7 +375,7 @@ public interface RedisOperations<K, V> {
|
||||
* @param expiration must not be {@literal null}.
|
||||
* @param options must not be {@literal null}.
|
||||
* @return changes to the expiry. {@literal null} when used in pipeline / transaction.
|
||||
* @throws IllegalArgumentException if the instant is {@literal null} or too large to represent as a {@code Date}.
|
||||
* @throws IllegalArgumentException any of the required arguments is {@literal null}.
|
||||
* @see <a href="https://redis.io/commands/expire">Redis Documentation: EXPIRE</a>
|
||||
* @see <a href="https://redis.io/commands/pexpire">Redis Documentation: PEXPIRE</a>
|
||||
* @see <a href="https://redis.io/commands/expireat">Redis Documentation: EXPIREAT</a>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package org.springframework.data.redis.core.types;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.springframework.data.redis.core.TimeoutUtils;
|
||||
|
||||
Reference in New Issue
Block a user