func (r *RedisStore) SetMap(key string, values map[string]interface{}) error {
	newValues := make(map[string]string, len(values))
	for k, v := range values {
		switch vv := v.(type) {
		case string:
			newValues[k] = vv
		default:
			newValues[k] = fmt.Sprintf("%v", vv)
		}
	}
	return r.client.HMSet(key, newValues).Err()
}
SetMap sets map for the given key.
package gokvstores
import (
	"fmt"
	"net"
	"time"
	redis "gopkg.in/redis.v5"
)
type RedisClient interface {
	Ping() *redis.StatusCmd
	Exists(key string) *redis.BoolCmd
	Del(keys ...string) *redis.IntCmd
	FlushDb() *redis.StatusCmd
	Close() error
	Process(cmd redis.Cmder) error
	Get(key string) *redis.StringCmd
	Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd
	MGet(keys ...string) *redis.SliceCmd
	HDel(key string, fields ...string) *redis.IntCmd
	HGetAll(key string) *redis.StringStringMapCmd
	HMSet(key string, fields map[string]string) *redis.StatusCmd
	SMembers(key string) *redis.StringSliceCmd
	SAdd(key string, members ...interface{}) *redis.IntCmd
	Keys(pattern string) *redis.StringSliceCmd
	Pipeline() *redis.Pipeline
}
type RedisPipeline struct {
	pipeline *redis.Pipeline
}
type RedisClientOptions struct {
	Network            string
	Addr               string
	Dialer             func() (net.Conn, error)
	Password           string
	DB                 int
	MaxRetries         int
	DialTimeout        time.Duration
	ReadTimeout        time.Duration
	WriteTimeout       time.Duration
	PoolSize           int
	PoolTimeout        time.Duration
	IdleTimeout        time.Duration
	IdleCheckFrequency time.Duration
	ReadOnly           bool
}
type RedisClusterOptions struct {
	Addrs              []string
	MaxRedirects       int
	ReadOnly           bool
	RouteByLatency     bool
	Password           string
	DialTimeout        time.Duration
	ReadTimeout        time.Duration
	WriteTimeout       time.Duration
	PoolSize           int
	PoolTimeout        time.Duration
	IdleTimeout        time.Duration
	IdleCheckFrequency time.Duration
}
type RedisStore struct {
	client     RedisClient
	expiration time.Duration
}
func (r *RedisStore) Get(key string) (interface{}, error) {
	cmd := redis.NewCmd("get", key)
	if err := r.client.Process(cmd); err != nil {
		if err == redis.Nil {
			return nil, nil
		}
		return nil, err
	}
	return cmd.Val(), cmd.Err()
}
func (r *RedisStore) MGet(keys []string) (map[string]interface{}, error) {
	values, err := r.client.MGet(keys...).Result()
	newValues := make(map[string]interface{}, len(keys))
	for k, v := range keys {
		value := values[k]
		if err != nil {
			return nil, err
		}
		newValues[v] = value
	}
	return newValues, nil
}
func (r *RedisStore) Set(key string, value interface{}) error {
	return r.client.Set(key, value, r.expiration).Err()
}
func (r *RedisStore) SetWithExpiration(key string, value interface{}, expiration time.Duration) error {
	return r.client.Set(key, value, expiration).Err()
}
func (r *RedisStore) GetMap(key string) (map[string]interface{}, error) {
	values, err := r.client.HGetAll(key).Result()
	if err != nil {
		return nil, err
	}
	if len(values) == 0 {
		return nil, nil
	}
	newValues := make(map[string]interface{}, len(values))
	for k, v := range values {
		newValues[k] = v
	}
	return newValues, nil
}