keystore

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedRedisDriver = errors.New("unsupported redis driver")
)

Functions

This section is empty.

Types

type Geter

type Geter interface {
	Get(ctx context.Context, key string) ([]byte, error)
}

type KeyStore

type KeyStore interface {
	Geter
	Seter
	Delete(ctx context.Context, key string) error
}

func NewRedisKeyStore

func NewRedisKeyStore(cfg RedisConfig) (KeyStore, error)

type RedisConfig

type RedisConfig struct {
	// Driver is the name of the redis driver to use
	//
	// Valid values are:
	// - "redis"
	// - "cluster"
	// - "sentinel"
	// - "sentinel-cluster"
	Driver string
	// ClientName is the name of the redis client
	ClientName string

	// Address is the host:port address of the redis server
	Address string
	// Addresses is a list of host:port addresses of redis servers
	Addresses []string
	// Password is the password to use when connecting to the redis server
	Password string
	// Username is the username to use when connecting to the redis server
	Username string
	// DB is the redis database to use
	DB int
}

type RedisDriver

type RedisDriver string
const (
	RedisDriverRedis           RedisDriver = "redis"
	RedisDriverCluster         RedisDriver = "cluster"
	RedisDriverSentinel        RedisDriver = "sentinel"
	RedisDriverSentinelCluster RedisDriver = "sentinel-cluster"
)

type Seter

type Seter interface {
	Set(ctx context.Context, key string, value any, expiration time.Duration) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL