@@ -255,11 +255,34 @@ public interface RedisHashCommands {
255
255
@ Nullable
256
256
Long hStrLen (byte [] key , byte [] field );
257
257
258
+ /**
259
+ * Apply a given {@link org.springframework.data.redis.core.types.Expiration} to the given {@literal fields}.
260
+ *
261
+ * @param key must not be {@literal null}.
262
+ * @param expiration the {@link org.springframework.data.redis.core.types.Expiration} to apply.
263
+ * @param fields the names of the {@literal fields} to apply the {@literal expiration} to.
264
+ * @return a {@link List} holding the command result for each field in order - {@code 2} indicating the specific field
265
+ * is deleted already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration
266
+ * time is set/updated; {@code 0} indicating the expiration time is not set; {@code -2} indicating there is no
267
+ * such field;
268
+ * @since 3.5
269
+ */
258
270
default @ Nullable List <Long > applyExpiration (byte [] key ,
259
271
org .springframework .data .redis .core .types .Expiration expiration , byte []... fields ) {
260
272
return applyExpiration (key , expiration , FieldExpirationOptions .none (), fields );
261
273
}
262
274
275
+ /**
276
+ * @param key must not be {@literal null}.
277
+ * @param expiration the {@link org.springframework.data.redis.core.types.Expiration} to apply.
278
+ * @param options additional options to be sent along with the command.
279
+ * @param fields the names of the {@literal fields} to apply the {@literal expiration} to.
280
+ * @return a {@link List} holding the command result for each field in order - {@code 2} indicating the specific field
281
+ * is deleted already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration
282
+ * time is set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT
283
+ * condition is not met); {@code -2} indicating there is no such field;
284
+ * @since 3.5
285
+ */
263
286
@ Nullable
264
287
default List <Long > applyExpiration (byte [] key , org .springframework .data .redis .core .types .Expiration expiration ,
265
288
FieldExpirationOptions options , byte []... fields ) {
@@ -304,9 +327,8 @@ default List<Long> applyExpiration(byte[] key, org.springframework.data.redis.co
304
327
* @param fields must not be {@literal null}.
305
328
* @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is
306
329
* deleted already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time
307
- * is set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition
308
- * is not met); {@code -2} indicating there is no such field; {@literal null} when used in pipeline /
309
- * transaction.
330
+ * is set/updated; {@code 0} indicating the expiration time is not set; {@code -2} indicating there is no such
331
+ * field; {@literal null} when used in pipeline / transaction.
310
332
* @see <a href="https://redis.io/docs/latest/commands/hexpire/">Redis Documentation: HEXPIRE</a>
311
333
* @since 3.5
312
334
*/
@@ -324,9 +346,8 @@ default List<Long> hExpire(byte[] key, long seconds, byte[]... fields) {
324
346
* @param fields must not be {@literal null}.
325
347
* @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is
326
348
* deleted already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time
327
- * is set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition
328
- * is not met); {@code -2} indicating there is no such field; {@literal null} when used in pipeline /
329
- * transaction.
349
+ * is set/updated; {@code 0} indicating the expiration time is not set; {@code -2} indicating there is no such
350
+ * field; {@literal null} when used in pipeline / transaction.
330
351
* @see <a href="https://redis.io/docs/latest/commands/hexpire/">Redis Documentation: HEXPIRE</a>
331
352
* @since 3.5
332
353
*/
@@ -362,9 +383,8 @@ default List<Long> hExpire(byte[] key, Duration ttl, byte[]... fields) {
362
383
* @param fields must not be {@literal null}.
363
384
* @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is
364
385
* deleted already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time
365
- * is set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition
366
- * is not met); {@code -2} indicating there is no such field; {@literal null} when used in pipeline /
367
- * transaction.
386
+ * is set/updated; {@code 0} indicating the expiration time is not set ; {@code -2} indicating there is no
387
+ * such field; {@literal null} when used in pipeline / transaction.
368
388
* @see <a href="https://redis.io/docs/latest/commands/hpexpire/">Redis Documentation: HPEXPIRE</a>
369
389
* @since 3.5
370
390
*/
@@ -382,9 +402,8 @@ default List<Long> hpExpire(byte[] key, long millis, byte[]... fields) {
382
402
* @param fields must not be {@literal null}.
383
403
* @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is
384
404
* deleted already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time
385
- * is set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition
386
- * is not met); {@code -2} indicating there is no such field; {@literal null} when used in pipeline /
387
- * transaction.
405
+ * is set/updated; {@code 0} indicating the expiration time is not set; {@code -2} indicating there is no such
406
+ * field; {@literal null} when used in pipeline / transaction.
388
407
* @see <a href="https://redis.io/docs/latest/commands/hpexpire/">Redis Documentation: HPEXPIRE</a>
389
408
* @since 3.5
390
409
*/
@@ -420,9 +439,8 @@ default List<Long> hpExpire(byte[] key, Duration ttl, byte[]... fields) {
420
439
* @param fields must not be {@literal null}.
421
440
* @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is
422
441
* deleted already due to expiration, or provided expiry interval is in the past; {@code 1} indicating
423
- * expiration time is set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX |
424
- * GT | LT condition is not met); {@code -2} indicating there is no such field; {@literal null} when used in
425
- * pipeline / transaction.
442
+ * expiration time is set/updated; {@code 0} indicating the expiration time is not set; {@code -2} indicating
443
+ * there is no such field; {@literal null} when used in pipeline / transaction.
426
444
* @see <a href="https://redis.io/docs/latest/commands/hexpireat/">Redis Documentation: HEXPIREAT</a>
427
445
* @since 3.5
428
446
*/
@@ -457,9 +475,8 @@ default List<Long> hExpireAt(byte[] key, long unixTime, byte[]... fields) {
457
475
* @param fields must not be {@literal null}.
458
476
* @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is
459
477
* deleted already due to expiration, or provided expiry interval is in the past; {@code 1} indicating
460
- * expiration time is set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX |
461
- * GT | LT condition is not met); {@code -2} indicating there is no such field; {@literal null} when used in
462
- * pipeline / transaction.
478
+ * expiration time is set/updated; {@code 0} indicating the expiration time is not set; {@code -2} indicating
479
+ * there is no such field; {@literal null} when used in pipeline / transaction.
463
480
* @see <a href="https://redis.io/docs/latest/commands/hpexpireat/">Redis Documentation: HPEXPIREAT</a>
464
481
* @since 3.5
465
482
*/
@@ -531,8 +548,6 @@ List<Long> hpExpireAt(byte[] key, long unixTimeInMillis, FieldExpirationOptions.
531
548
* @since 3.5
532
549
*/
533
550
@ Nullable
534
- // TODO: this is complete nonsense as it would jeopardize negative values
535
- // TODO: this should be a List<Map.Entry<byte, Expiration>>
536
551
List <Long > hTtl (byte [] key , TimeUnit timeUnit , byte []... fields );
537
552
538
553
/**
0 commit comments