redigogo

package module
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AdapterType_Alone   = 1
	AdapterType_Cluster = 2
)
View Source
const (
	REDIS_CONN_TIMEOUT    = 500
	REDIS_READ_TIMEOUT    = 500
	REDIS_WRITE_TIMEOUT   = 500
	REDIS_KEEP_ALIVE_TIME = 30
	REDIS_ALIVE_TIME      = 60
)

Variables

View Source
var AdapterMap = make(map[AdaperType]Instance)

Functions

func Register

func Register(adapter AdaperType, inst Instance) (err error)

Types

type AdaperType

type AdaperType int

func (AdaperType) GoString

func (a AdaperType) GoString() string

func (AdaperType) String

func (a AdaperType) String() string

type Cache

type Cache interface {
	Close()
	Do(cmd string, args ...interface{}) (interface{}, error)
	Int(reply interface{}, err error) (int, error)
	Int64(reply interface{}, err error) (int64, error)
	Float64(reply interface{}, err error) (float64, error)
	String(reply interface{}, err error) (string, error)
	Bytes(reply interface{}, err error) ([]byte, error)
	Bool(reply interface{}, err error) (bool, error)
	Values(reply interface{}, err error) ([]interface{}, error)
	Ints(reply interface{}, err error) ([]int, error)
	Strings(reply interface{}, err error) ([]string, error)
	StringMap(result interface{}, err error) (map[string]string, error)
	Scan(src []interface{}, dst ...interface{}) ([]interface{}, error)
	Unmarshal(dst interface{}, reply interface{}, err error) error
	IsNilReply(err error) bool
}

func NewCache

func NewCache(c *Config) (cache Cache)

type Config

type Config struct {
	Password       string   `json:"password"`        //auth password
	Index          int      `json:"db_index"`        //db index
	MasterHost     string   `json:"master_host"`     //master node
	ReplicateHosts []string `json:"replicate_hosts"` //replicate node
	ConnTimeout    int      `json:"conn_timeout"`    //millisecond, default 500 ms
	ReadTimeout    int      `json:"read_timeout"`    //millisecond, default 500 ms
	WriteTimeout   int      `json:"write_timeout"`   //millisecond, default 500 ms
	KeepAlive      int      `json:"keep_alive"`      //second, default 30s
	AliveTime      int      `json:"alive_time"`      //second, default 60s
}

type Instance

type Instance func(c *Config) Cache

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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