HPExpireWithArgs - Sets the expiration time for specified fields in a hash in milliseconds. It requires a key, an expiration duration, a struct with boolean flags for conditional expiration settings (NX, XX, GT, LT), and a list of fields. The command constructs an argument list starting with "HPEXPI
(ctx context.Context, key string, expiration time.Duration, expirationArgs HExpireArgs, fields ...string)
| 312 | // |
| 313 | // [HPEXPIRE Documentation]: https://redis.io/commands/hpexpire/ |
| 314 | func (c cmdable) HPExpireWithArgs(ctx context.Context, key string, expiration time.Duration, expirationArgs HExpireArgs, fields ...string) *IntSliceCmd { |
| 315 | args := []interface{}{"HPEXPIRE", key, formatMs(ctx, expiration)} |
| 316 | |
| 317 | // only if one argument is true, we can add it to the args |
| 318 | // if more than one argument is true, it will cause an error |
| 319 | if expirationArgs.NX { |
| 320 | args = append(args, "NX") |
| 321 | } else if expirationArgs.XX { |
| 322 | args = append(args, "XX") |
| 323 | } else if expirationArgs.GT { |
| 324 | args = append(args, "GT") |
| 325 | } else if expirationArgs.LT { |
| 326 | args = append(args, "LT") |
| 327 | } |
| 328 | |
| 329 | args = append(args, "FIELDS", len(fields)) |
| 330 | |
| 331 | for _, field := range fields { |
| 332 | args = append(args, field) |
| 333 | } |
| 334 | cmd := NewIntSliceCmd(ctx, args...) |
| 335 | _ = c(ctx, cmd) |
| 336 | return cmd |
| 337 | } |
| 338 | |
| 339 | // HExpireAt - Sets the expiration time for specified fields in a hash to a UNIX timestamp in seconds. |
| 340 | // Takes a key, a UNIX timestamp, a struct of conditional flags, and a list of fields. |
nothing calls this directly
no test coverage detected