This is different from the RESP standard. It needs to enrich the algorithm to support more atomic instructions.
(m uhaha.Machine, args []string)
| 660 | } |
| 661 | |
| 662 | // expireSecondsFromMillis converts a millisecond TTL into the whole seconds the |
| 663 | // storage layer keeps, rounding up so a key never expires earlier than asked for. |
| 664 | func expireSecondsFromMillis(ms int64) int64 { |
| 665 | if ms <= 0 { |
| 666 | return 0 |
| 667 | } |
| 668 | sec := ms / 1000 |
| 669 | if ms%1000 != 0 { |
| 670 | sec++ |
| 671 | } |
| 672 | return sec |
| 673 | } |
| 674 | |
| 675 | // cmdSET implements the Redis SET command. |