19 Star 83 Fork 8

piaohao / godis

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
redis_bench_test.go 608 Bytes
一键复制 编辑 原始数据 按行查看 历史
package godis
import "testing"
func BenchmarkSet(b *testing.B) {
b.ResetTimer()
pool := NewPool(nil, option)
for i := 0; i < b.N; i++ {
redis, _ := pool.GetResource()
redis.Set("godis", "good")
redis.Close()
}
}
func BenchmarkGet(b *testing.B) {
b.ResetTimer()
pool := NewPool(nil, option)
for i := 0; i < b.N; i++ {
redis, _ := pool.GetResource()
redis.Get("godis")
redis.Close()
}
}
func BenchmarkIncr(b *testing.B) {
flushAll()
b.ResetTimer()
pool := NewPool(nil, option)
i := 0
for ; i < b.N; i++ {
redis, _ := pool.GetResource()
redis.Incr("godis")
redis.Close()
}
}
Go
1
https://gitee.com/piaohao/godis.git
git@gitee.com:piaohao/godis.git
piaohao
godis
godis
master

搜索帮助