Browse Source

增加rpop

master v1.5.2
loshiqi 2 years ago
parent
commit
8d64d44e08
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      list.go

+ 13
- 0
list.go View File

@ -18,7 +18,20 @@ func Rpush(key string, field interface{}) (int64, error) {
return redisdb.Int64(reply, nil) 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 头部增加值 //list 头部增加值
func Lpush(key string, field interface{}) (int64, error) { func Lpush(key string, field interface{}) (int64, error) {


Loading…
Cancel
Save