package redisdb import ( "context" "encoding/json" "fmt" ) // SetKeyValue ... func (s Server) 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) } s.rdb.Set(ctx, key, b, opts.ttl) }