tangs b030ce89ca openbilibili | 5 years ago | |
---|---|---|
.. | ||
test | 5 years ago | |
BUILD | 5 years ago | |
CHANGELOG.md | 5 years ago | |
CONTRIBUTORS.md | 5 years ago | |
OWNERS | 5 years ago | |
README.md | 5 years ago | |
client.go | 5 years ago | |
client_test.go | 5 years ago | |
conn.go | 5 years ago | |
conn_test.go | 5 years ago | |
errors.go | 5 years ago | |
memcache.go | 5 years ago | |
memcache_test.go | 5 years ago | |
mock.go | 5 years ago | |
pool.go | 5 years ago | |
pool_test.go | 5 years ago | |
trace.go | 5 years ago | |
util.go | 5 years ago | |
util_test.go | 5 years ago |
- 提供protobuf,gob,json序列化方式,gzip的memcache接口
- 请只用golang v1.7.x以上版本编译执行。
- 执行当前目录下所有测试文件,测试所有功能
- 使用protobuf需要在pb文件目录下运行business/make.sh脚本生成go文件才能使用
// 初始化
mc := memcache.New(&memcache.Config{})
// 增加 key
err = mc.Set(c, &memcache.Item{})
// 删除key
err := mc.Delete(c,key)
// 获得某个key的内容
err := mc.Get(c,key).Scan(&v)
// 获取多个key的内容
replies, err := mc.GetMulti(c, keys)
for _, key := range replies.Keys() {
if err = rows.Scan(key, &v); err != nil {
return
}
}