Redis-client-Golang
https://redis.io/
http://redis.cn/
http://redis.cn/documentation.html
http://redis.cn/clients.html#go
https://github.com/gomodule/redigo
https://godoc.org/github.com/gomodule/redigo/redis
使用golang實現redis的客戶端
1.下載
go get -u -v github.com/gomodule/redigo
2.入門
1.創建項目
mkdir -p $GOPATH/src/redisClient && cd $_
go mod init redisClient
touch main.go
tee $GOPATH/src/redisClient/main.go<<-'EOF'
package main
import "github.com/gomodule/redigo/redis"
func main(){
conn,_ := redis.Dial("tcp", "127.0.0.1:6379")
defer conn.Close()
conn.Do("set", "hello", "world")
}
EOF
go run main.go
2.在redis-cli中查詢
get hello