DATAREDIS-611 - Update Javadoc and remove superfluous negativity limitations.

Original Pull Request: #501
This commit is contained in:
Christoph Strobl
2020-01-27 12:38:09 +01:00
parent 31d4730222
commit 75fcb0ec3d
5 changed files with 18 additions and 8 deletions

View File

@@ -64,14 +64,15 @@ public interface BoundKeyOperations<K> {
* Sets the key time-to-live/expiration.
*
* @param timeout must not be {@literal null}.
* @return true if expiration was set, false otherwise. {@literal null} when used in pipeline / transaction.
* @return {@literal true} if expiration was set, {@literal false} otherwise. {@literal null} when used in pipeline /
* transaction.
* @throws IllegalArgumentException if the timeout is {@literal null}.
* @since 2.3
*/
@Nullable
default Boolean expire(Duration timeout) {
Assert.notNull(timeout, "Timeout must not be null");
Assert.isTrue(!timeout.isNegative(), "Timeout must not be negative");
return expire(timeout.toMillis(), TimeUnit.MILLISECONDS);
}
@@ -98,14 +99,16 @@ public interface BoundKeyOperations<K> {
/**
* Sets the key time-to-live/expiration.
*
* @param time expiration time.
* @return true if expiration was set, false otherwise. {@literal null} when used in pipeline / transaction.
* @param expireAt expiration time.
* @return {@literal true} if expiration was set, {@literal false} otherwise. {@literal null} when used in pipeline /
* transaction.
* @throws IllegalArgumentException if the instant is {@literal null} or too large to represent as a {@code Date}.
* @since 2.3
*/
@Nullable
default Boolean expireAt(Instant expireAt) {
Assert.notNull(expireAt, "Timestamp must not be null");
Assert.notNull(expireAt, "ExpireAt must not be null");
return expireAt(Date.from(expireAt));
}

View File

@@ -196,6 +196,7 @@ public interface BoundListOperations<K, V> extends BoundKeyOperations<K> {
*
* @param timeout must not be {@literal null}.
* @return {@literal null} when timeout reached or used in pipeline / transaction.
* @throws IllegalArgumentException if the timeout is {@literal null} or negative.
* @since 2.3
* @see <a href="https://redis.io/commands/blpop">Redis Documentation: BLPOP</a>
*/
@@ -235,6 +236,7 @@ public interface BoundListOperations<K, V> extends BoundKeyOperations<K> {
*
* @param timeout must not be {@literal null}.
* @return {@literal null} when timeout reached or used in pipeline / transaction.
* @throws IllegalArgumentException if the timeout is {@literal null} or negative.
* @since 2.3
* @see <a href="https://redis.io/commands/brpop">Redis Documentation: BRPOP</a>
*/

View File

@@ -243,6 +243,7 @@ public interface ListOperations<K, V> {
* @param key must not be {@literal null}.
* @param timeout must not be {@literal null}.
* @return can be {@literal null}.
* @throws IllegalArgumentException if the timeout is {@literal null} or negative.
* @since 2.3
* @see <a href="https://redis.io/commands/blpop">Redis Documentation: BLPOP</a>
*/
@@ -330,6 +331,7 @@ public interface ListOperations<K, V> {
* @param destinationKey must not be {@literal null}.
* @param timeout must not be {@literal null}.
* @return can be {@literal null}.
* @throws IllegalArgumentException if the timeout is {@literal null} or negative.
* @since 2.3
* @see <a href="https://redis.io/commands/brpoplpush">Redis Documentation: BRPOPLPUSH</a>
*/

View File

@@ -289,13 +289,13 @@ public interface RedisOperations<K, V> {
* @param key must not be {@literal null}.
* @param timeout must not be {@literal null}.
* @return {@literal null} when used in pipeline / transaction.
* @throws IllegalArgumentException if the timeout is {@literal null}.
* @since 2.3
*/
@Nullable
default Boolean expire(K key, Duration timeout) {
Assert.notNull(timeout, "Timeout must not be null");
Assert.isTrue(!timeout.isNegative(), "Timeout must not be negative");
return TimeoutUtils.hasMillis(timeout) ? expire(key, timeout.toMillis(), TimeUnit.MILLISECONDS)
: expire(key, timeout.getSeconds(), TimeUnit.SECONDS);
@@ -317,6 +317,7 @@ public interface RedisOperations<K, V> {
* @param key must not be {@literal null}.
* @param expireAt must not be {@literal null}.
* @return {@literal null} when used in pipeline / transaction.
* @throws IllegalArgumentException if the instant is {@literal null} or too large to represent as a {@code Date}.
* @since 2.3
*/
@Nullable