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

Function cmdLEXPIREAT

lists.go:116–140  ·  view source on GitHub ↗
(m uhaha.Machine, args []string)

Source from the content-addressed store, hash-verified

114 v, err := ldb.LTTL([]byte(args[1]))
115 if err != nil {
116 return nil, err
117 }
118 return redcon.SimpleInt(v), nil
119}
120
121func cmdLEXPIREAT(m uhaha.Machine, args []string) (interface{}, error) {
122 if len(args) != 3 {
123 return nil, uhaha.ErrWrongNumArgs
124 }
125
126 timestamp, err := ledis.StrInt64([]byte(args[2]), nil)
127 if err != nil {
128 return nil, err
129 }
130
131 //If the timestamp is less than the current time, delete operation: There are boundary conditions here: because it is a queue, the rollback of the raft log is sequential
132 if timestamp < time.Now().Unix() {
133 _, err := ldb.LClear([]byte(args[1]))
134 if err != nil {
135 return nil, err
136 }
137 return redcon.SimpleInt(0), nil
138 }
139
140 v, err := ldb.LExpireAt([]byte(args[1]), timestamp)
141 if err != nil {
142 return nil, err
143 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected