(m uhaha.Machine, args []string)
| 140 | v, err := ldb.LExpireAt([]byte(args[1]), timestamp) |
| 141 | if err != nil { |
| 142 | return nil, err |
| 143 | } |
| 144 | return redcon.SimpleInt(v), nil |
| 145 | } |
| 146 | |
| 147 | func cmdLEXPIRE(m uhaha.Machine, args []string) (interface{}, error) { |
| 148 | if len(args) != 3 { |
| 149 | return nil, uhaha.ErrWrongNumArgs |
| 150 | } |
| 151 | |
| 152 | duration, err := ledis.StrInt64([]byte(args[2]), nil) |
| 153 | if err != nil { |
| 154 | return nil, err |
| 155 | } |
| 156 | |
| 157 | timestamp := m.Now().Unix() + duration |
| 158 | //If the timestamp is less than the current time, delete operation |
| 159 | if timestamp < time.Now().Unix() { |
| 160 | _, err := ldb.LClear([]byte(args[1])) |
| 161 | if err != nil { |
| 162 | return nil, err |
| 163 | } |
| 164 | return redcon.SimpleInt(0), nil |
| 165 | } |
| 166 | |
| 167 | v, err := ldb.LExpireAt([]byte(args[1]), timestamp) |
| 168 | if err != nil { |
| 169 | return nil, err |
| 170 | } |
nothing calls this directly
no outgoing calls
no test coverage detected