package redis import ( "context" "github.com/redis/go-redis/v9" ) const ( NostrKeyspace = iota LndKeyspace = iota ) type Redis struct { Client *redis.Client } var ( NostrRedisConn *Redis LndRedisConn *Redis ) func New(address string, password string, database int) (*Redis, error) { client := redis.NewClient(&redis.Options{ Addr: address, Password: password, DB: database, }) ctx := context.TODO() if err := client.Ping(ctx).Err(); err != nil { return nil, err } return &Redis{ Client: client, }, nil }