SetIFEQ Redis `SET key value [expiration] IFEQ match-value` command. Compare-and-set: only sets the value if the current value equals matchValue. Returns "OK" on success. Returns nil if the operation was aborted due to condition not matching. Zero expiration means the key has no expiration time. N
(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration)
| 654 | // NOTE SetIFEQ is still experimental |
| 655 | // it's signature and behaviour may change |
| 656 | func (c cmdable) SetIFEQ(ctx context.Context, key string, value interface{}, matchValue interface{}, expiration time.Duration) *StatusCmd { |
| 657 | args := []interface{}{"set", key, value} |
| 658 | |
| 659 | if expiration > 0 { |
| 660 | if usePrecise(expiration) { |
| 661 | args = append(args, "px", formatMs(ctx, expiration)) |
| 662 | } else { |
| 663 | args = append(args, "ex", formatSec(ctx, expiration)) |
| 664 | } |
| 665 | } else if expiration == KeepTTL { |
| 666 | args = append(args, "keepttl") |
| 667 | } |
| 668 | |
| 669 | args = append(args, "ifeq", matchValue) |
| 670 | |
| 671 | cmd := NewStatusCmd(ctx, args...) |
| 672 | _ = c(ctx, cmd) |
| 673 | return cmd |
| 674 | } |
| 675 | |
| 676 | // SetIFEQGet Redis `SET key value [expiration] IFEQ match-value GET` command. |
| 677 | // Compare-and-set with GET: only sets the value if the current value equals matchValue, |
nothing calls this directly
no test coverage detected