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

Function cmdHEXPIREAT

hashes.go:319–343  ·  view source on GitHub ↗
(m uhaha.Machine, args []string)

Source from the content-addressed store, hash-verified

317 }
318 return redcon.SimpleInt(v), nil
319}
320
321func cmdHEXPIREAT(m uhaha.Machine, args []string) (interface{}, error) {
322 if len(args) != 3 {
323 return nil, uhaha.ErrWrongNumArgs
324 }
325
326 timestamp, err := ledis.StrInt64([]byte(args[2]), nil)
327 if err != nil {
328 return nil, err
329 }
330
331 //If the timestamp is less than the current time, delete operation
332 if timestamp < time.Now().Unix() {
333 _, err := ldb.HClear([]byte(args[1]))
334 if err != nil {
335 return nil, err
336 }
337 return redcon.SimpleInt(0), nil
338 }
339
340 v, err := ldb.HExpireAt([]byte(args[1]), timestamp)
341 if err != nil {
342 return nil, err
343 }
344 return redcon.SimpleInt(v), nil
345}
346

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected