kv

package
v0.0.0-...-35fa672 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoClient error = errors.New("no memcache client")

Functions

func Add

func Add(name string, c *Config) error

func AddByUnix

func AddByUnix(name string, c *UnixConfig) error

func Del

func Del(key string) error

func Get

func Get(key string) ([]byte, error)

func GetMcClient

func GetMcClient() *memcache.Client

func GetRedisConn

func GetRedisConn(name string) (*redis.Client, error)

func InitMcClient

func InitMcClient(c *MConfig)

func NewRedisClientWithConfig

func NewRedisClientWithConfig(c *Config) (*redis.Client, error)

Types

type Config

type Config struct {
	Addrs       []string `toml:"addrs" json:"addrs"`
	Pwd         string   `toml:"pwd" json:"pwd"`
	PoolSize    int      `toml:"pool_size" json:"pool_size"`
	ReadTimeout int      `toml:"read_timeout" json:"read_timeout"` //单位ms
}

func (*Config) Parse

func (c *Config) Parse() (*redis.Options, error)

type MConfig

type MConfig struct {
	Addrs    []string `toml:"addrs" json:"addrs"`
	PoolSize int      `toml:"pool_size" json:"pool_size"`
}

memcache 的配置

func (*MConfig) GetAddrs

func (c *MConfig) GetAddrs() []string

func (*MConfig) GetPoolSize

func (c *MConfig) GetPoolSize() int

type UnixConfig

type UnixConfig struct {
	Addr     string `toml:"addr" json:"addr"`
	PoolSize int    `toml:"pool_size" json:"pool_size"`
}

Jump to

Keyboard shortcuts

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