(m uhaha.Machine, args []string)
| 290 | } |
| 291 | return redcon.SimpleInt(n), nil |
| 292 | } |
| 293 | |
| 294 | func cmdHEXPIRE(m uhaha.Machine, args []string) (interface{}, error) { |
| 295 | if len(args) != 3 { |
| 296 | return nil, uhaha.ErrWrongNumArgs |
| 297 | } |
| 298 | |
| 299 | duration, err := ledis.StrInt64([]byte(args[2]), nil) |
| 300 | if err != nil { |
| 301 | return nil, err |
| 302 | } |
| 303 | |
| 304 | timestamp := m.Now().Unix() + duration |
| 305 | //If the timestamp is less than the current time, delete operation |
| 306 | if timestamp < time.Now().Unix() { |
| 307 | _, err := ldb.HClear([]byte(args[1])) |
| 308 | if err != nil { |
| 309 | return nil, err |
| 310 | } |
| 311 | return redcon.SimpleInt(0), nil |
| 312 | } |
| 313 | |
| 314 | v, err := ldb.HExpireAt([]byte(args[1]), timestamp) |
| 315 | if err != nil { |
| 316 | return nil, err |
| 317 | } |
| 318 | return redcon.SimpleInt(v), nil |
| 319 | } |
| 320 |
nothing calls this directly
no outgoing calls
no test coverage detected