rds

package
v0.0.0-...-d73eb14 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEF_REDIS_INDEX      = 1         // Redis默认索引
	DEF_REDIS_PASSWORD   = "abc#123" // Redis默认密码
	DEF_REDIS_START_EXLE = 5         // Redis默认最大空闲连接数
	DEF_REDIS_MAX_ACTIVE = 10        // Redis默认最大打开连接数
	DEF_REDIS_IS_WAIT    = true      // Redis默认负荷时等待
	DEF_TASK_CSIZE       = 500       // 任务数量
)

----------------------------------------------------------------------------- =================================常量定义==================================== -----------------------------------------------------------------------------

Variables

This section is empty.

Functions

func MakeRedisPool

func MakeRedisPool(config *SConfig) (*redis.Pool, error)

Types

type IRedisCacher

type IRedisCacher interface {

	// 开启连接池
	StartConnectPool(config *SConfig) error

	// 关闭连接
	CloseConnectPool()

	// 执行命令
	Execute(commandName string, args ...interface{}) (reply interface{}, err error)

	// 执行任务
	ExecuteTask(taskType int, commandName string, args ...interface{}) error
}

func MakeRedisCache

func MakeRedisCache(config *SConfig, handler IRedisCacherHandler) (IRedisCacher, error)

type IRedisCacherHandler

type IRedisCacherHandler interface {

	// 处理任务回应结果
	HandleRedisTask(task *STask)
}

type RedisCache

type RedisCache struct {
	mss.ServiceHandle
	IRedisCacher
}

func (*RedisCache) HandleInit

func (this *RedisCache) HandleInit(own mss.ISeriOwner)

func (*RedisCache) HandleRedisTask

func (this *RedisCache) HandleRedisTask(task *STask)

func (*RedisCache) HandleStat

func (this *RedisCache) HandleStat() string

func (*RedisCache) HandleTerm

func (this *RedisCache) HandleTerm(reason error)

func (*RedisCache) HandleTick

func (this *RedisCache) HandleTick(now time.Time)

type SConfig

type SConfig struct {
	Host      string
	DBIndex   int
	Password  string
	MaxIdle   int
	MaxActive int
	// 下面的可默认
	IdleTimeOut  int
	IsWait       bool
	ReadTimeOut  int
	WriteTimeOut int
	ConnTimeOut  int
}

______________________________________

func NewConfig

func NewConfig(host string) *SConfig

----------------------------------------------------------------------------- ==================================全局函数=================================== -----------------------------------------------------------------------------

type STask

type STask struct {
	TaskType int // 用户自定义数据可不填
	CmdName  string
	CmdArgs  []interface{}
	Response interface{}
	Error    error
}

______________________________________

Jump to

Keyboard shortcuts

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