Categorygithub.com/go-packagist/rediser/v2
modulepackage
2.0.0
Repository: https://github.com/go-packagist/rediser.git
Documentation: pkg.go.dev

# README

Redis'er(Redis Manager)

Go Go Version GoDoc codecov Go Report Card tests MIT license

Installation

go get github.com/go-packagist/rediser/v2

Usage

package main

import (
	"context"
	"github.com/go-packagist/rediser/v2"
	"github.com/redis/go-redis/v9"
)

var ctx = context.Background()

func main() {
	m := rediser.New(&rediser.Config{
		Default: "db1",
		Connections: map[string]rediser.Configable{
			"db1": &redis.Options{
				Addr:     "localhost:6379",
				Password: "", // no password set
				DB:       0,  // use default DB
			},
			"db2": &redis.Options{
				Addr:     "localhost:6379",
				Password: "", // no password set
				DB:       1,  // use default DB
			},
		},
	}, rediser.WithInstance)

	m.Connect().Set(ctx, "aaa", "1", 0).Err()                  // use default(db1)
	m.Connect("db1").Set(ctx, "aaa", "1", 0).Err()             // db1
	m.Connect("db2").Set(ctx, "bbb", "1", 0).Err()             // db2
	rediser.Instance().Connect().Set(ctx, "ccc", "1", 0).Err() // use instance
	rediser.Connect().Set(ctx, "ddd", "1", 0).Err()            // use instance connect
}

License

The MIT License (MIT). Please see License File for more information.

# Functions

No description provided by the author
No description provided by the author
New a redis manager.
No description provided by the author
WithInstance set instance.

# Structs

No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author