tinyredis

package
v1.0.34 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package tinyredis provides utilities for handling Redis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial added in v1.0.15

func Dial(address string, opts ...Opt) (*redis.Client, error)

Dial creates a connection to Redis and returns *redis.Client instance.

Types

type Config

type Config struct {
	// Username is an optional property used in authorization.
	Username string

	// Password is an optional property used in authorization.
	Password string

	// DB is a database number to use (default: 0).
	DB int

	// TLSConfig setting it to non-nil value enables TLS mode.
	TLSConfig *tls.Config

	// ConnectionTimeout is a maximum time client should spend trying to connect (default: 5s).
	ConnectionTimeout time.Duration

	// NoPing indicates whether Dial should skip the initial call to Ping method (default: false).
	NoPing bool
}

Config holds a configuration for Dial call.

type Opt

type Opt = func(*Config)

Opt is an option to be specified to Dial.

func ConnectionTimeout

func ConnectionTimeout(connectionTimeout time.Duration) Opt

ConnectionTimeout is a maximum time client should spend trying to connect.

func DB

func DB(db int) Opt

DB is a database number to use.

func NoPing added in v1.0.15

func NoPing() Opt

NoPing indicates that Dial should skip the initial call to Ping method.

func Password

func Password(password string) Opt

Password is an optional property used in authorization.

func TLSConfig

func TLSConfig(tlsConfig *tls.Config) Opt

TLSConfig setting it to non-nil value enables TLS mode.

func Username

func Username(username string) Opt

Username is an optional property used in authorization.

Jump to

Keyboard shortcuts

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