@@ -255,11 +255,34 @@ public interface RedisHashCommands {
255255@ Nullable
256256Long hStrLen (byte [] key , byte [] field );
257257
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+ */
258270default @ Nullable List <Long > applyExpiration (byte [] key ,
259271org .springframework .data .redis .core .types .Expiration expiration , byte []... fields ) {
260272return applyExpiration (key , expiration , FieldExpirationOptions .none (), fields );
261273}
262274
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+ */
263286@ Nullable
264287default List <Long > applyExpiration (byte [] key , org .springframework .data .redis .core .types .Expiration expiration ,
265288FieldExpirationOptions options , byte []... fields ) {
@@ -304,9 +327,8 @@ default List<Long> applyExpiration(byte[] key, org.springframework.data.redis.co
304327 * @param fields must not be {@literal null}.
305328 * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is
306329 * 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.
310332 * @see <a href="https://redis.io/docs/latest/commands/hexpire/">Redis Documentation: HEXPIRE</a>
311333 * @since 3.5
312334 */
@@ -324,9 +346,8 @@ default List<Long> hExpire(byte[] key, long seconds, byte[]... fields) {
324346 * @param fields must not be {@literal null}.
325347 * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is
326348 * 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.
330351 * @see <a href="https://redis.io/docs/latest/commands/hexpire/">Redis Documentation: HEXPIRE</a>
331352 * @since 3.5
332353 */
@@ -362,9 +383,8 @@ default List<Long> hExpire(byte[] key, Duration ttl, byte[]... fields) {
362383 * @param fields must not be {@literal null}.
363384 * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is
364385 * 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.
368388 * @see <a href="https://redis.io/docs/latest/commands/hpexpire/">Redis Documentation: HPEXPIRE</a>
369389 * @since 3.5
370390 */
@@ -382,9 +402,8 @@ default List<Long> hpExpire(byte[] key, long millis, byte[]... fields) {
382402 * @param fields must not be {@literal null}.
383403 * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is
384404 * 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.
388407 * @see <a href="https://redis.io/docs/latest/commands/hpexpire/">Redis Documentation: HPEXPIRE</a>
389408 * @since 3.5
390409 */
@@ -420,9 +439,8 @@ default List<Long> hpExpire(byte[] key, Duration ttl, byte[]... fields) {
420439 * @param fields must not be {@literal null}.
421440 * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is
422441 * 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.
426444 * @see <a href="https://redis.io/docs/latest/commands/hexpireat/">Redis Documentation: HEXPIREAT</a>
427445 * @since 3.5
428446 */
@@ -457,9 +475,8 @@ default List<Long> hExpireAt(byte[] key, long unixTime, byte[]... fields) {
457475 * @param fields must not be {@literal null}.
458476 * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is
459477 * 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.
463480 * @see <a href="https://redis.io/docs/latest/commands/hpexpireat/">Redis Documentation: HPEXPIREAT</a>
464481 * @since 3.5
465482 */
@@ -531,8 +548,6 @@ List<Long> hpExpireAt(byte[] key, long unixTimeInMillis, FieldExpirationOptions.
531548 * @since 3.5
532549 */
533550@ Nullable
534- // TODO: this is complete nonsense as it would jeopardize negative values
535- // TODO: this should be a List<Map.Entry<byte, Expiration>>
536551List <Long > hTtl (byte [] key , TimeUnit timeUnit , byte []... fields );
537552
538553/**
0 commit comments