redisconfig

package
v0.0.0-...-cb90f35 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const RedisConfigKey = "redisConfig"

Variables

This section is empty.

Functions

func GetRedisClientCtx

func GetRedisClientCtx(ctx context.Context) *redis.Client

func GetRedisClientReq

func GetRedisClientReq(r *http.Request) *redis.Client

func OpenClient

func OpenClient(o RedisOptions) *redis.Client

OpenClient creates a new redis client.

func TestConnection

func TestConnection(o RedisOptions)

TestConnection fails if the connection can not be established

func UseRedisConfig

func UseRedisConfig(next http.HandlerFunc, config RedisOptions) http.HandlerFunc

Types

type RedisOptions

type RedisOptions struct {
	Address  string
	Password string
	Database int
}

RedisOptions configures all important redis parameter.

func GetRedisConfigCtx

func GetRedisConfigCtx(ctx context.Context) RedisOptions

func GetRedisConfigReq

func GetRedisConfigReq(r *http.Request) RedisOptions

func NewDefaultRedisOptions

func NewDefaultRedisOptions() RedisOptions

NewDefaultRedisOptions returns the default redis options.

func ParseViperConfig

func ParseViperConfig() RedisOptions

ParseViperConfig tries to map a viper configuration to LoggingOptions

Jump to

Keyboard shortcuts

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