package urlrewrite

import (
	"context"

	"github.com/redis/go-redis/v9"
)

func newRedisClient(ctx context.Context, addr, username, password string) (*redis.Client, error) {
	rdb := redis.NewClient(&redis.Options{
		Addr:     addr,
		Username: username,
		Password: password,
	})
	if err := rdb.Ping(ctx).Err(); err != nil {
		return nil, err
	}
	return rdb, nil
}
