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 | // This is different from the RESP standard. It needs to enrich the algorithm to support more atomic instructions. |
| 662 | func cmdSET(m uhaha.Machine, args []string) (interface{}, error) { |
| 663 | if len(args) != 3 { |
| 664 | return nil, uhaha.ErrWrongNumArgs |
| 665 | } |
| 666 | |
| 667 | if err := ldb.Set([]byte(args[1]), []byte(args[2])); err != nil { |
| 668 | return nil, err |
| 669 | } |
| 670 | |
| 671 | return redcon.SimpleString("OK"), nil |
| 672 | } |
| 673 | |
| 674 | // Setex is rewritten as setexat to avoid the exception of raft log playback |
| 675 | func cmdSETEX(m uhaha.Machine, args []string) (interface{}, error) { |