GO redis

 

package main
 
import (
        "fmt"
        "github.com/go-redis/redis"
)
 
func main() {
        client := redis.NewClient(&redis.Options{
                Addr:     "127.0.0.1:6380",
                Password: "",
                DB:       0,
        })
 
        var reply int64
        var err error
        reply, err = client.LPush("key", "value1", "value2", "value3").Result()
        fmt.Printf("reply=%d err_lpush=%v\n", reply, err) 
}

输出:

reply=3 err_lpush=<nil>

  

读写队列的相关命令LPush,RPush,LRange,LPop,RPop的用法示例:https://blog.csdn.net/pengpengzhou/article/details/108361064

posted @ 2021-03-17 20:47  程序生(Codey)  阅读(109)  评论(0编辑  收藏  举报