go redis
1、安装导入
使用第三方开源的redis库: github.com/garyburd/redigo/redis
go get github.com/garyburd/redigo/redis import "github.com/garyburd/redigo/redis"
github:https://github.com/antirez/redis
Doc:http://godoc.org/github.com/garyburd/redigo/redis
使用
2、连接
package main import ( "fmt" "github.com/garyburd/redigo/redis" ) func main() { c, err := redis.Dial("tcp", "localhost:6379") if err != nil { fmt.Println("conn redis failed,", err) return } defer c.Close() }
时间: 2024-11-06 21:05:11