redis

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*redis.Client
}

func NewRedisClient

func NewRedisClient(cfg Config) (*Client, error)

NewRedisClient simplify GET SET DEL operation

func (*Client) Del

func (c *Client) Del(key string) error

func (*Client) DelContext

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

func (*Client) Get

func (c *Client) Get(key string) (interface{}, error)

Get return String value

func (*Client) GetContext

func (c *Client) GetContext(ctx context.Context, key string) (interface{}, error)

func (*Client) Set

func (c *Client) Set(key string, value interface{}) error

func (*Client) SetContext

func (c *Client) SetContext(ctx context.Context, key string, value interface{}, expiration time.Duration) error

func (*Client) SetWithTTL

func (c *Client) SetWithTTL(key string, value interface{}, expiration time.Duration) error

type ClusterClient

type ClusterClient struct {
	*redis.ClusterClient
}

func NewRedisClusterClient

func NewRedisClusterClient(cfg ClusterConfig) (*ClusterClient, error)

type ClusterConfig

type ClusterConfig struct {
	Addrs []string
	Options
}

type Config

type Config struct {
	Addr string `defval:"127.0.0.1:6379"`
	DB   int    `defval:"0"`
	Options
}

type Options

type Options struct {
	Username string
	Password string
	// max retry,  not retry = -1,  default, single=0 cluster=8
	MaxRetries int
	// timeout
	DialTimeoutSec  int64 `defval:"60"`
	ReadTimeoutSec  int64 `defval:"300"`
	WriteTimeoutSec int64 `defval:"300"`
}

Jump to

Keyboard shortcuts

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