redis

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseReply

type BaseReply struct {
	// contains filtered or unexported fields
}

BaseReply base reply

func (*BaseReply) DuringTime

func (b *BaseReply) DuringTime() time.Duration

DuringTime return during time

func (*BaseReply) RequestTime

func (b *BaseReply) RequestTime() time.Time

RequestTime return request time

func (*BaseReply) ResponseTime

func (b *BaseReply) ResponseTime() time.Time

ResponseTime return response time

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client redis client

func NewClient

func NewClient(config *ConfigDefinition) (client *Client, err error)

NewClient new redis client

func (*Client) Get

func (c *Client) Get(key string) *StringReply

func (*Client) Set

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

type Commands

type Commands interface {
	Get(key string) *StringReply
	Set(key, value string) *StringReply
}

Commands redis commands

type ConfigDefinition

type ConfigDefinition struct {
	// redis地址
	Address string
	// 密码
	Password string
	// 池中空闲连接的最大数量 .
	MaxIdle int
	// 池在给定时间分配的最大连接数。
	// 当为零时,池中的连接数没有限制。
	MaxActive int
	// 在这段时间内保持空闲后关闭连接。 如果值
	// 为零,则不关闭空闲连接。 应用程序应设置
	// 超时值小于服务器的超时值。
	// 单位秒
	IdleTimeout int
	// 如果 Wait 为真并且池处于 MaxActive 限制,则 Get() 等待
	// 用于在返回之前将连接返回到池中。
	Wait bool
	// 关闭早于此持续时间的连接。 如果该值为零,则
	// 池不会根据年龄关闭连接。
	// 单位秒
	MaxConnLifetime int
}

ConfigDefinition redis配置信息

type Reply

type Reply interface {
	RequestTime() time.Time

	ResponseTime() time.Time
	DuringTime() time.Duration
	// contains filtered or unexported methods
}

Reply redis request reply

type StringReply

type StringReply struct {
	BaseReply
	// contains filtered or unexported fields
}

StringReply string reply

Jump to

Keyboard shortcuts

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