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

Callers

nothing calls this directly

Calls 1

handleExpirationFunction · 0.85

Tested by

no test coverage detected