cmdEXPIRE sets an expiration time for a key.
(m uhaha.Machine, args []string)
| 81 | |
| 82 | // cmdEXPIRE sets an expiration time for a key. |
| 83 | func cmdEXPIRE(m uhaha.Machine, args []string) (interface{}, error) { |
| 84 | if len(args) != 3 { |
| 85 | return nil, uhaha.ErrWrongNumArgs |
| 86 | } |
| 87 | |
| 88 | duration, err := ledis.StrInt64([]byte(args[2]), nil) |
| 89 | if err != nil { |
| 90 | return nil, fmt.Errorf("ERR invalid duration: %v", err) |
| 91 | } |
| 92 | |
| 93 | return handleExpiration([]byte(args[1]), m.Now().Unix() + duration) |
| 94 | } |
| 95 | |
| 96 | // cmdSTRLEN returns the length of the string value stored at key. |
| 97 | // If the key does not exist, it returns 0. |
nothing calls this directly
no test coverage detected