MCPcopy Create free account
hub / github.com/dadgar/onecache / parse

Method parse

onecache/memcache_handlers.go:256–292  ·  view source on GitHub ↗
(flags []string)

Source from the content-addressed store, hash-verified

254}
255
256func (h *replaceHandler) parse(flags []string) error {
257 l := len(flags)
258 if l != 4 && l != 5 {
259 return fmt.Errorf("received an unexpected number of flags (%d); expect %v", l, expectedSetInput)
260 }
261
262 h.args.Key = flags[0]
263
264 flag, err := strconv.ParseInt(flags[1], 10, 32)
265 if err != nil {
266 return fmt.Errorf("could not parse flag field: %v", err)
267 }
268 h.args.Flags = int32(flag)
269
270 exp, err := strconv.ParseInt(flags[2], 10, 32)
271 if err != nil {
272 return fmt.Errorf("could not parse expiration field: %v", err)
273 return err
274 }
275 h.args.Exp = convertMemcacheExpToUnix(int32(exp))
276
277 bytes, err := strconv.ParseInt(flags[3], 10, 64)
278 if err != nil {
279 return fmt.Errorf("could not parse bytes field: %v", err)
280 }
281 h.size = bytes
282
283 if l == 5 {
284 if flags[4] != noreply {
285 return fmt.Errorf("was expecting %v; got %v", noreply, flags[4])
286 }
287
288 h.noReply = true
289 }
290
291 return nil
292}
293
294func (h *replaceHandler) readBytes() int64 {
295 return h.size

Callers

nothing calls this directly

Calls 1

convertMemcacheExpToUnixFunction · 0.85

Tested by

no test coverage detected