MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / cmdDEL

Function cmdDEL

strings.go:765–785  ·  view source on GitHub ↗

This is different from the RESP standard. For the sake of transaction consistency, there is no key existence judgment.

(m uhaha.Machine, args []string)

Source from the content-addressed store, hash-verified

763 return nil, err
764 }
765 }
766
767 return redcon.SimpleString("OK"), nil
768}
769
770// Setex is rewritten as setexat to avoid the exception of raft log playback
771func cmdSETEX(m uhaha.Machine, args []string) (interface{}, error) {
772 if len(args) != 4 {
773 return nil, uhaha.ErrWrongNumArgs
774 }
775
776 duration, err := ledis.StrInt64([]byte(args[2]), nil)
777 if err != nil {
778 return nil, err
779 }
780 timestamp := m.Now().Unix() + duration
781
782 //If the timestamp is less than the current time, delete operation
783 if timestamp < time.Now().Unix() {
784 keys := make([][]byte, 1)
785 keys[0] = []byte(args[1])
786 _, err := ldb.Del(keys...)
787 if err != nil {
788 return nil, err

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected