2323
2424import org .jspecify .annotations .NonNull ;
2525import org .jspecify .annotations .NullUnmarked ;
26+ import org .jspecify .annotations .Nullable ;
2627import org .springframework .data .redis .connection .BitFieldSubCommands ;
2728import org .springframework .util .Assert ;
2829
3435 * @author Mark Paluch
3536 * @author Jiahe Cai
3637 * @author Marcin Grzejszczak
38+ * @author Chris Bono
3739 */
3840@ NullUnmarked
3941public interface ValueOperations <K , V > {
@@ -60,7 +62,7 @@ public interface ValueOperations<K, V> {
6062 * @see <a href="https://redis.io/commands/set">Redis Documentation: SET</a>
6163 * @since 3.5
6264 */
63- V setGet (@ NonNull K key , @ NonNull V value , long timeout , @ NonNull TimeUnit unit );
65+ @ Nullable V setGet (@ NonNull K key , @ NonNull V value , long timeout , @ NonNull TimeUnit unit );
6466
6567 /**
6668 * Set the {@code value} and expiration {@code timeout} for {@code key}. Return the old string stored at key, or
@@ -74,7 +76,7 @@ public interface ValueOperations<K, V> {
7476 * @see <a href="https://redis.io/commands/set">Redis Documentation: SET</a>
7577 * @since 3.5
7678 */
77- V setGet (@ NonNull K key , @ NonNull V value , @ NonNull Duration duration );
79+ @ Nullable V setGet (@ NonNull K key , @ NonNull V value , @ NonNull Duration duration );
7880
7981 /**
8082 * Set the {@code value} and expiration {@code timeout} for {@code key}.
@@ -226,7 +228,7 @@ default Boolean setIfPresent(@NonNull K key, @NonNull V value, @NonNull Duration
226228 * @return {@literal null} when key does not exist or used in pipeline / transaction.
227229 * @see <a href="https://redis.io/commands/get">Redis Documentation: GET</a>
228230 */
229- V get (Object key );
231+ @ Nullable V get (Object key );
230232
231233 /**
232234 * Return the value at {@code key} and delete the key.
@@ -236,7 +238,7 @@ default Boolean setIfPresent(@NonNull K key, @NonNull V value, @NonNull Duration
236238 * @see <a href="https://redis.io/commands/getdel">Redis Documentation: GETDEL</a>
237239 * @since 2.6
238240 */
239- V getAndDelete (@ NonNull K key );
241+ @ Nullable V getAndDelete (@ NonNull K key );
240242
241243 /**
242244 * Return the value at {@code key} and expire the key by applying {@code timeout}.
@@ -248,7 +250,7 @@ default Boolean setIfPresent(@NonNull K key, @NonNull V value, @NonNull Duration
248250 * @see <a href="https://redis.io/commands/getex">Redis Documentation: GETEX</a>
249251 * @since 2.6
250252 */
251- V getAndExpire (@ NonNull K key , long timeout , @ NonNull TimeUnit unit );
253+ @ Nullable V getAndExpire (@ NonNull K key , long timeout , @ NonNull TimeUnit unit );
252254
253255 /**
254256 * Return the value at {@code key} and expire the key by applying {@code timeout}.
@@ -259,7 +261,7 @@ default Boolean setIfPresent(@NonNull K key, @NonNull V value, @NonNull Duration
259261 * @see <a href="https://redis.io/commands/getex">Redis Documentation: GETEX</a>
260262 * @since 2.6
261263 */
262- V getAndExpire (@ NonNull K key , @ NonNull Duration timeout );
264+ @ Nullable V getAndExpire (@ NonNull K key , @ NonNull Duration timeout );
263265
264266 /**
265267 * Return the value at {@code key} and persist the key. This operation removes any TTL that is associated with
@@ -270,7 +272,7 @@ default Boolean setIfPresent(@NonNull K key, @NonNull V value, @NonNull Duration
270272 * @see <a href="https://redis.io/commands/getex">Redis Documentation: GETEX</a>
271273 * @since 2.6
272274 */
273- V getAndPersist (@ NonNull K key );
275+ @ Nullable V getAndPersist (@ NonNull K key );
274276
275277 /**
276278 * Set {@code value} of {@code key} and return its old value.
@@ -279,7 +281,7 @@ default Boolean setIfPresent(@NonNull K key, @NonNull V value, @NonNull Duration
279281 * @return {@literal null} when key does not exist or used in pipeline / transaction.
280282 * @see <a href="https://redis.io/commands/getset">Redis Documentation: GETSET</a>
281283 */
282- V getAndSet (@ NonNull K key , @ NonNull V value );
284+ @ Nullable V getAndSet (@ NonNull K key , @ NonNull V value );
283285
284286 /**
285287 * Get multiple {@code keys}. Values are in the order of the requested keys Absent field values are represented using
@@ -289,7 +291,7 @@ default Boolean setIfPresent(@NonNull K key, @NonNull V value, @NonNull Duration
289291 * @return {@literal null} when used in pipeline / transaction.
290292 * @see <a href="https://redis.io/commands/mget">Redis Documentation: MGET</a>
291293 */
292- List <V > multiGet (@ NonNull Collection <@ NonNull K > keys );
294+ List <@ Nullable V > multiGet (@ NonNull Collection <@ NonNull K > keys );
293295
294296 /**
295297 * Increment an integer value stored as string value under {@code key} by one.
0 commit comments