GO

GO: 实例 t_redis.go

2017-07-11  本文已影响11人  随风化作雨
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()
}
上一篇下一篇

猜你喜欢

热点阅读