package redisdb import ( "context" "encoding/json" "fmt" ) // SetKeyValue ... func SetKeyValue(ctx context.Context, key string, value interface{}, options ...Options) { b, err := json.Marshal(value) if err != nil { fmt.Printf("[redisdb] SetKeyValue error: %s - data: %s - %v \n", err.Error(), key, value) return } // get options opts := allOptions{} for _, o := range options { o.apply(&opts) } rdb.Set(ctx, key, b, opts.ttl) }