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

Function cmdEXPIRE

strings.go:83–94  ·  view source on GitHub ↗

cmdEXPIRE sets an expiration time for a key.

(m uhaha.Machine, args []string)

Source from the content-addressed store, hash-verified

81
82// cmdEXPIRE sets an expiration time for a key.
83func cmdEXPIRE(m uhaha.Machine, args []string) (interface{}, error) {
84 if len(args) != 3 {
85 return nil, uhaha.ErrWrongNumArgs
86 }
87
88 duration, err := ledis.StrInt64([]byte(args[2]), nil)
89 if err != nil {
90 return nil, fmt.Errorf("ERR invalid duration: %v", err)
91 }
92
93 return handleExpiration([]byte(args[1]), m.Now().Unix() + duration)
94}
95
96// cmdSTRLEN returns the length of the string value stored at key.
97// If the key does not exist, it returns 0.

Callers

nothing calls this directly

Calls 1

handleExpirationFunction · 0.85

Tested by

no test coverage detected