MCPcopy
hub / github.com/CodisLabs/codis / Hset

Method Hset

extern/deprecated/redis-test/utils.go:424–446  ·  view source on GitHub ↗
(c *Conn, k, v string)

Source from the content-addressed store, hash-verified

422}
423
424func (u *Unit) Hset(c *Conn, k, v string) {
425 var rsp interface{}
426 defer func() {
427 if x := recover(); x != nil {
428 Panic("hset: c = %s, key = '%s', error = '%s', rsp = %v", c.Addr(), u.key, x, rsp)
429 }
430 }()
431 switch u.val.(type) {
432 default:
433 panic("not a hset")
434 case nil:
435 u.val = make(map[string]string)
436 case map[string]string:
437 }
438 var err error
439 if rsp, err = c.Do("hset", u.key, k, v); err != nil {
440 panic(err)
441 }
442 if x := c.Int(rsp); x != 0 && x != 1 {
443 panic(fmt.Sprintf("return = %d, expect = 0 or 1", x))
444 }
445 u.val.(map[string]string)[k] = v
446}
447
448func (u *Unit) GetHset(c *Conn) {
449 var rsp interface{}

Callers 1

playerMethod · 0.80

Calls 4

PanicFunction · 0.70
AddrMethod · 0.45
DoMethod · 0.45
IntMethod · 0.45

Tested by

no test coverage detected