/** * Set the {@code value} and expiration {@code timeout} for {@code key}. * * @param key must not be {@literal null}. * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @throws IllegalArgumentException if either {@code key}, {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/setex">Redis Documentation: SETEX</a> * @since 2.1 */ default void set(K key, V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { set(key, value, timeout.toMillis(), TimeUnit.MILLISECONDS); } else { set(key, value, timeout.getSeconds(), TimeUnit.SECONDS); } }
/** * Set the bound key to hold the string {@code value} and expiration {@code timeout} if {@code key} is present. * * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. * @throws IllegalArgumentException if either {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a> * @since 2.1 */ @Nullable default Boolean setIfPresent(V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { return setIfPresent(value, timeout.toMillis(), TimeUnit.MILLISECONDS); } return setIfPresent(value, timeout.getSeconds(), TimeUnit.SECONDS); }
/** * Set the {@code value} and expiration {@code timeout} for the bound key. * * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @throws IllegalArgumentException if either {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/setex">Redis Documentation: SETEX</a> * @since 2.1 */ default void set(V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { set(value, timeout.toMillis(), TimeUnit.MILLISECONDS); } else { set(value, timeout.getSeconds(), TimeUnit.SECONDS); } }
/** * Set bound key to hold the string {@code value} and expiration {@code timeout} if {@code key} is absent. * * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. * @throws IllegalArgumentException if either {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a> * @since 2.1 */ @Nullable default Boolean setIfAbsent(V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { return setIfAbsent(value, timeout.toMillis(), TimeUnit.MILLISECONDS); } return setIfAbsent(value, timeout.getSeconds(), TimeUnit.SECONDS); }
/** * Set {@code key} to hold the string {@code value} and expiration {@code timeout} if {@code key} is absent. * * @param key must not be {@literal null}. * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. * @throws IllegalArgumentException if either {@code key}, {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a> * @since 2.1 */ @Nullable default Boolean setIfAbsent(K key, V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { return setIfAbsent(key, value, timeout.toMillis(), TimeUnit.MILLISECONDS); } return setIfAbsent(key, value, timeout.getSeconds(), TimeUnit.SECONDS); }
/** * Set {@code key} to hold the string {@code value} and expiration {@code timeout} if {@code key} is present. * * @param key must not be {@literal null}. * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. * @throws IllegalArgumentException if either {@code key}, {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a> * @since 2.1 */ @Nullable default Boolean setIfPresent(K key, V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { return setIfPresent(key, value, timeout.toMillis(), TimeUnit.MILLISECONDS); } return setIfPresent(key, value, timeout.getSeconds(), TimeUnit.SECONDS); }
/** * Set the {@code value} and expiration {@code timeout} for {@code key}. * * @param key must not be {@literal null}. * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @throws IllegalArgumentException if either {@code key}, {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/setex">Redis Documentation: SETEX</a> * @since 2.1 */ default void set(K key, V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { set(key, value, timeout.toMillis(), TimeUnit.MILLISECONDS); } else { set(key, value, timeout.getSeconds(), TimeUnit.SECONDS); } }
/** * Set the {@code value} and expiration {@code timeout} for {@code key}. * * @param key must not be {@literal null}. * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @throws IllegalArgumentException if either {@code key}, {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/setex">Redis Documentation: SETEX</a> * @since 2.1 */ default void set(K key, V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { set(key, value, timeout.toMillis(), TimeUnit.MILLISECONDS); } else { set(key, value, timeout.getSeconds(), TimeUnit.SECONDS); } }
/** * Set the bound key to hold the string {@code value} and expiration {@code timeout} if {@code key} is present. * * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. * @throws IllegalArgumentException if either {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a> * @since 2.1 */ @Nullable default Boolean setIfPresent(V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { return setIfPresent(value, timeout.toMillis(), TimeUnit.MILLISECONDS); } return setIfPresent(value, timeout.getSeconds(), TimeUnit.SECONDS); }
/** * Set the {@code value} and expiration {@code timeout} for the bound key. * * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @throws IllegalArgumentException if either {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/setex">Redis Documentation: SETEX</a> * @since 2.1 */ default void set(V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { set(value, timeout.toMillis(), TimeUnit.MILLISECONDS); } else { set(value, timeout.getSeconds(), TimeUnit.SECONDS); } }
/** * Set {@code key} to hold the string {@code value} and expiration {@code timeout} if {@code key} is absent. * * @param key must not be {@literal null}. * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. * @throws IllegalArgumentException if either {@code key}, {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a> * @since 2.1 */ @Nullable default Boolean setIfAbsent(K key, V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { return setIfAbsent(key, value, timeout.toMillis(), TimeUnit.MILLISECONDS); } return setIfAbsent(key, value, timeout.getSeconds(), TimeUnit.SECONDS); }
/** * Set bound key to hold the string {@code value} and expiration {@code timeout} if {@code key} is absent. * * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. * @throws IllegalArgumentException if either {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a> * @since 2.1 */ @Nullable default Boolean setIfAbsent(V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { return setIfAbsent(value, timeout.toMillis(), TimeUnit.MILLISECONDS); } return setIfAbsent(value, timeout.getSeconds(), TimeUnit.SECONDS); }
/** * Set bound key to hold the string {@code value} and expiration {@code timeout} if {@code key} is absent. * * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. * @throws IllegalArgumentException if either {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a> * @since 2.1 */ @Nullable default Boolean setIfAbsent(V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { return setIfAbsent(value, timeout.toMillis(), TimeUnit.MILLISECONDS); } return setIfAbsent(value, timeout.getSeconds(), TimeUnit.SECONDS); }
/** * Set the bound key to hold the string {@code value} and expiration {@code timeout} if {@code key} is present. * * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. * @throws IllegalArgumentException if either {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a> * @since 2.1 */ @Nullable default Boolean setIfPresent(V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { return setIfPresent(value, timeout.toMillis(), TimeUnit.MILLISECONDS); } return setIfPresent(value, timeout.getSeconds(), TimeUnit.SECONDS); }
/** * Set the {@code value} and expiration {@code timeout} for the bound key. * * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @throws IllegalArgumentException if either {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/setex">Redis Documentation: SETEX</a> * @since 2.1 */ default void set(V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { set(value, timeout.toMillis(), TimeUnit.MILLISECONDS); } else { set(value, timeout.getSeconds(), TimeUnit.SECONDS); } }
/** * Set {@code key} to hold the string {@code value} and expiration {@code timeout} if {@code key} is present. * * @param key must not be {@literal null}. * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. * @throws IllegalArgumentException if either {@code key}, {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a> * @since 2.1 */ @Nullable default Boolean setIfPresent(K key, V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { return setIfPresent(key, value, timeout.toMillis(), TimeUnit.MILLISECONDS); } return setIfPresent(key, value, timeout.getSeconds(), TimeUnit.SECONDS); }
/** * Set {@code key} to hold the string {@code value} and expiration {@code timeout} if {@code key} is present. * * @param key must not be {@literal null}. * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. * @throws IllegalArgumentException if either {@code key}, {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a> * @since 2.1 */ @Nullable default Boolean setIfPresent(K key, V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { return setIfPresent(key, value, timeout.toMillis(), TimeUnit.MILLISECONDS); } return setIfPresent(key, value, timeout.getSeconds(), TimeUnit.SECONDS); }
/** * Set {@code key} to hold the string {@code value} and expiration {@code timeout} if {@code key} is absent. * * @param key must not be {@literal null}. * @param value must not be {@literal null}. * @param timeout must not be {@literal null}. * @return {@literal null} when used in pipeline / transaction. * @throws IllegalArgumentException if either {@code key}, {@code value} or {@code timeout} is not present. * @see <a href="http://redis.io/commands/set">Redis Documentation: SET</a> * @since 2.1 */ @Nullable default Boolean setIfAbsent(K key, V value, Duration timeout) { Assert.notNull(timeout, "Timeout must not be null!"); if (TimeoutUtils.hasMillis(timeout)) { return setIfAbsent(key, value, timeout.toMillis(), TimeUnit.MILLISECONDS); } return setIfAbsent(key, value, timeout.getSeconds(), TimeUnit.SECONDS); }