func BenchmarkAlphazeroRedisSet(b *testing.B) {
	var err error
	for i := 0; i < b.N; i++ {
		err = alphazeroRedisClient.Set("hello", to.Bytes(1))
		if err != nil {
			b.Fatalf(err.Error())
			break
		}
	}
}
示例#2
0
文件: redis.go 项目: AidHamza/redis
// Command builds a command specified by the `values` interface and stores the
// result into the variable pointed by `dest`.
func (c *Client) Command(dest interface{}, values ...interface{}) error {
	if c == nil {
		return ErrNotInitialized
	}
	bvalues := make([][]byte, len(values))
	// Converting all input values into []byte.
	for i := range values {
		bvalues[i] = to.Bytes(values[i])
	}
	// Sending command to redis-server.
	return c.command(dest, bvalues...)
}
func BenchmarkAlphazeroRedisLPush(b *testing.B) {
	var err error
	alphazeroRedisClient.Del("hello")

	for i := 0; i < b.N; i++ {
		err = alphazeroRedisClient.Lpush("hello", to.Bytes(i))
		if err != nil {
			b.Fatalf(err.Error())
			break
		}
	}
}