package main
import (
"fmt"
"github.com/garyburd/redigo/redis"
)
func main() {
rs, err := redis.Dial("tcp", "192.168.9.73:6379")
if err != nil {
fmt.Println("Connect to redis error:", err.Error())
return
}
fmt.Println(rs)
//key := "eGW_CONFIG"
key := "name"
value, err := redis.String(rs.Do("GET", key))
if err != nil {
fmt.Println("Fail to get the value:", err.Error())
}
fmt.Println(value)
defer rs.Close()
}
网友评论