数据库MemcachedGo客户端

go客户端:gomemcache(该客户端不支持密码连接)客户端介绍:

https://godoc.org/github.com/bradfitz/gomemcache/memcache

将客户端包下载到GOPATH:gogetgithub.com/bradfitz/gomemcache/memcachego代码示例:

 

packagegomemcachedimport("fmt""github.com/bradfitz/gomemcache/memcache")funcmain(){mc:=memcache.New("ip:port")//可通过添加多个京东云数据库的ip:port来实现集群版客户端mc.Set(&memcache.Item{Key:"key",Value:[]byte("value")})it,err:=mc.Get("key")iferr!=nil{panic(err)}fmt.Printf("Value:%s",it.Value)}

 

标签

发表评论