1
0
mirror of https://github.com/redis/go-redis.git synced 2025-06-14 01:21:30 +03:00

More benchmarks.

This commit is contained in:
Vladimir Mihailenco
2014-07-04 15:19:45 +03:00
parent 42ce58ed85
commit 00a131e3a9
4 changed files with 82 additions and 6 deletions

View File

@ -3138,3 +3138,27 @@ func (t *RedisTest) BenchmarkRedisMGet(c *C) {
}
}
}
func (t *RedisTest) BenchmarkSetExpire(c *C) {
for i := 0; i < c.N; i++ {
if err := t.client.Set("key", "hello").Err(); err != nil {
panic(err)
}
if err := t.client.Expire("key", time.Second).Err(); err != nil {
panic(err)
}
}
}
func (t *RedisTest) BenchmarkPipeline(c *C) {
for i := 0; i < c.N; i++ {
_, err := t.client.Pipelined(func(pipe *redis.Pipeline) error {
pipe.Set("key", "hello")
pipe.Expire("key", time.Second)
return nil
})
if err != nil {
panic(err)
}
}
}