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

Function cmdSEXPIRE

set.go:158–179  ·  view source on GitHub ↗
(m uhaha.Machine, args []string)

Source from the content-addressed store, hash-verified

156 if len(args) < 2 {
157 return nil, uhaha.ErrWrongNumArgs
158 }
159
160 n, err := ldb.SMclear(stringSliceToBytes(args[1:])...)
161
162 return redcon.SimpleInt(n), err
163}
164
165func cmdSEXPIRE(m uhaha.Machine, args []string) (interface{}, error) {
166 if len(args) != 3 {
167 return nil, uhaha.ErrWrongNumArgs
168 }
169
170 duration, err := ledis.StrInt64([]byte(args[2]), nil)
171 if err != nil {
172 return nil, uhaha.ErrInvalid
173 }
174
175 timestamp := m.Now().Unix() + duration
176 if timestamp < time.Now().Unix() {
177 _, err := ldb.SClear([]byte(args[1]))
178 if err != nil {
179 return nil, err
180 }
181 return redcon.SimpleInt(0), nil
182 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected