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

Method Lpush

extern/deprecated/redis-test/utils.go:323–347  ·  view source on GitHub ↗
(c *Conn, s string)

Source from the content-addressed store, hash-verified

321}
322
323func (u *Unit) Lpush(c *Conn, s string) {
324 var rsp interface{}
325 defer func() {
326 if x := recover(); x != nil {
327 Panic("lpush: c = %s, key = '%s', error = '%s', rsp = %v", c.Addr(), u.key, x, rsp)
328 }
329 }()
330 switch u.val.(type) {
331 default:
332 panic("not a string list")
333 case nil:
334 u.val = list.New()
335 case *list.List:
336 }
337 l := u.val.(*list.List)
338 var err error
339 if rsp, err = c.Do("lpush", u.key, s); err != nil {
340 panic(err)
341 }
342 v := c.Int(rsp)
343 if x := l.Len() + 1; x != v {
344 panic(fmt.Sprintf("return = %d, except = %d", s, v, x))
345 }
346 l.PushFront(s)
347}
348
349func (u *Unit) Lpop(c *Conn) {
350 var rsp interface{}

Callers 2

playerMethod · 0.80
playerMethod · 0.80

Calls 5

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

Tested by

no test coverage detected