diff --git a/list.go b/list.go index 6e610b4..2bdc648 100644 --- a/list.go +++ b/list.go @@ -18,7 +18,20 @@ func Rpush(key string, field interface{}) (int64, error) { return redisdb.Int64(reply, nil) } +//移除列表的最后一个元素,返回值为移除的元素。 +func Rpop(key string) ([]byte, error) { + c := GetConn() + + ret, err := c.Do("RPOP", key) + CloseConn(c) + + if err != nil { + return nil, err + } + reply, err := redisdb.Bytes(ret, err) + return reply, err +} //list 头部增加值 func Lpush(key string, field interface{}) (int64, error) {