redis

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeLocal    = "local"
	ModeSentinel = "sentinel"
	ModeCluster  = "cluster"
)

Variables

View Source
var (
	ConfMode = config.Key("redis", "mode")

	ConfAddr = config.Key("redis", "addr")

	ConfDatabase = config.Key("redis", "database")

	ConfUsername = config.Key("redis", "username")

	ConfPassword = config.Key("redis", "password")
)
View Source
var (
	ModuleName = dep.Name("wk", "redis")
)

Functions

func Module

func Module() dep.Module

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func (*Client) GetAny added in v0.1.3

func (c *Client) GetAny(ctx context.Context, key string, valuePtr any) error

func (*Client) GetBytes added in v0.1.3

func (c *Client) GetBytes(ctx context.Context, key string) ([]byte, error)

func (*Client) GetString added in v0.1.3

func (c *Client) GetString(ctx context.Context, key string) (string, error)

func (*Client) GetTTL added in v0.1.3

func (c *Client) GetTTL(ctx context.Context, key string) (*time.Duration, error)

func (*Client) Key added in v0.1.3

func (c *Client) Key(args ...string) string

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

func (*Client) SetAny added in v0.1.3

func (c *Client) SetAny(ctx context.Context, key string, value any) error

func (*Client) SetBytes added in v0.1.3

func (c *Client) SetBytes(ctx context.Context, key string, value []byte) error

func (*Client) SetString added in v0.1.3

func (c *Client) SetString(ctx context.Context, key, value string) error

func (*Client) SetTTL added in v0.1.3

func (c *Client) SetTTL(ctx context.Context, key string, ttl time.Duration) error

type Configuration

type Configuration struct {
	Mode    string
	Servers []ServerConfiguration
}

func ConfigFrom

func ConfigFrom(ctx context.Context, conf config.Config) (*Configuration, error)

type ServerConfiguration

type ServerConfiguration struct {
	Addr     string
	Database int
	Password string
	Username string
}

Jump to

Keyboard shortcuts

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