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

Function cmdSETNX

strings.go:731–742  ·  view source on GitHub ↗
(m uhaha.Machine, args []string)

Source from the content-addressed store, hash-verified

729 // Redis answers a null bulk when the NX/XX condition is not met.
730 return nil, nil
731 }
732
733 // Storage drops a key's expiration on every write, so KEEPTTL has to read
734 // the remaining time first and re-apply it after the write.
735 var keptTTL int64 = -1
736 if keepttl {
737 if keptTTL, err = ldb.TTL(key); err != nil {
738 return nil, err
739 }
740 }
741
742 ttl := keptTTL
743 switch {
744 case exSeconds > 0:
745 ttl = exSeconds

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected