go连接操作redis示例代码
代码语言:golang
所属分类:其他
代码描述:go连接操作redis示例代码,使用github.com/go-redis/redis包
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
package main import ( "time" "fmt" "github.com/go-redis/redis" ) var Client *redis.Client func init() { Client = redis.NewClient(&redis.Options{ Addr: "127.0.0.1:6379", PoolSize: 1000, ReadTimeout: time.Millisecond * time.Duration(100), WriteTimeout: time.Millisecond * time.Duration(100), IdleTimeout: time.Second * time.Duration(60), }) _, err := Client.Ping().Result() if err != nil { .........完整代码请登录后点击上方下载按钮下载查看
网友评论0