redisdb/set_key_value.go

18 lines
299 B
Go
Raw Normal View History

2021-08-09 03:36:09 +00:00
package redisdb
import (
"context"
"encoding/json"
"fmt"
)
// SetKeyValue ...
func SetKeyValue(ctx context.Context, key string, value interface{}) {
b, err := json.Marshal(value)
if err != nil {
fmt.Println("redisdb - SetKeyValue error", err.Error())
return
}
rdb.Set(ctx, key, b, 0)
}