redis

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MulanPSL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateClient = DefaultNewClient1

Functions

func DefaultNewClient1

func DefaultNewClient1(c *ClientConfig, cc *Config) (clt *redis.Client, err error)

Types

type Client

type Client struct {
	Client *redis.Client
	Cfg    ClientConfig

	ApiLog func(args [][2]interface{}) func()
	// contains filtered or unexported fields
}

func (*Client) CliFlags

func (c *Client) CliFlags(name string) []cli.Flag

func (*Client) Load

func (c *Client) Load(r *Component, name string, cfg *Config, appCfg gsf.Config, log logger.Interface) (err error)

func (*Client) Ref

func (c *Client) Ref() *Component

type ClientConfig

type ClientConfig struct {
	Host       string `json:"host"         yaml:"host"`
	Pwd        string `json:"password"     yaml:"password"`
	DB         int    `json:"db"           yaml:"db"`
	MinIdleNum int    `json:"min_idle_num" yaml:"max_req_time"`
	MaxConnNum int    `json:"max_con_num"  yaml:"max_con_num"`
}

type Component

type Component struct {
	DSNPrint bool
	Cfg      Config
	Clts     map[string]*Client
}

func (*Component) CliFlags

func (c *Component) CliFlags() []cli.Flag

func (*Component) Close

func (c *Component) Close(_ logger.Interface, _ gsf.Config) (err error)

func (*Component) Init

func (c *Component) Init(log logger.Interface, cfg gsf.Config) error

func (*Component) Run

func (c *Component) Run(log logger.Interface, cfg gsf.Config) error

type Config

type Config struct {
	MaxReadTime    int `json:"max_sock_read_time"  yaml:"max_sock_read_time"`
	MaxWriteTime   int `json:"max_sock_write_time" yaml:"max_sock_write_time"`
	MaxRequestTime int `json:"max_request_time"    yaml:"max_request_time"`
	IdleCheckTime  int `json:"idle_check_time"     yaml:"idle_check_time"`
	SlowThreshold  int `json:"slow_threshold"      yaml:"slow_threshold"`
}

Jump to

Keyboard shortcuts

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