go-redis in golang

来源:转载

func main() {//设置redis服务器地址spac := redis.DefaultSpec().Host("202.108.33.173")log.Print("spac:", spac)//创建一个异步的clientClient, err := redis.NewAsynchClientWithSpec(spac)if err != nil {log.Fatal(err)}log.Println("Redis: ", Client)//get xk := "x"futureBytes, err := Client.Get(k)if err != nil {log.Panicln(err)}v, _ := futureBytes.Get();log.Println(k, "=", string(v))//set xv1 := "你好"futureBool,e := Client.Set(k, []byte(v1))if e != nil {log.Print(e);}//get return valueboolx , _ := futureBool.Get();log.Printf("set %s=>%B", k, boolx);}



分享给朋友:
您可能感兴趣的文章:
随机阅读: