redis

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Network      string
	Addr         string
	Auth         string
	Active       int
	Idle         int
	DialTimeout  xtime.Duration
	ReadTimeout  xtime.Duration
	WriteTimeout xtime.Duration
	IdleTimeout  xtime.Duration
	Expire       xtime.Duration
}

Config .

type Pool

type Pool struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Pool Redis缓存池结构

func New

func New(c *Config) *Pool

func (*Pool) Decr

func (p *Pool) Decr(key string) (int64, error)

Decr 将key所储存的数字值减一

func (*Pool) DecrBy

func (p *Pool) DecrBy(key string, decrement int64) (int64, error)

DecrBy 将key所储存的数字值减去减量decrement

func (*Pool) Del

func (p *Pool) Del(key string) (bool, error)

Del 删除给定key

func (*Pool) Do

func (p *Pool) Do(cmd string, args ...interface{}) (interface{}, error)

Do 向Redis服务发送命令并返回收到的答复

func (*Pool) Exists

func (p *Pool) Exists(key string) (bool, error)

Exists 检查给定key是否存在

func (*Pool) GetBytes

func (p *Pool) GetBytes(key string) ([]byte, error)

GetBytes 返回给定key所关联的[]byte值

func (*Pool) GetInt

func (p *Pool) GetInt(key string) (int, error)

GetInt 返回给定key所关联的int值

func (*Pool) GetInt64

func (p *Pool) GetInt64(key string) (int64, error)

GetInt64 返回给定key所关联的int64值

func (*Pool) GetString

func (p *Pool) GetString(key string) (string, error)

GetString 返回给定key所关联的string值

func (*Pool) Incr

func (p *Pool) Incr(key string) (int64, error)

Incr 将key所储存的数字值增一

func (*Pool) IncrBy

func (p *Pool) IncrBy(key string, increment int64) (int64, error)

IncrBy 将key所储存的数字值加上增量increment

func (*Pool) Read

func (p *Pool) Read(key string, obj interface{}) error

Read 将给定key所关联的值反序列化到obj对象

func (*Pool) Set

func (p *Pool) Set(key string, data interface{}, time ...int) error

Set 将数据data关联到给定key,time为key的超时时间(秒)

func (*Pool) TTL

func (p *Pool) TTL(key string) (int, error)

TTL 返回给定key的剩余生存时间(秒)

func (*Pool) Write

func (p *Pool) Write(key string, obj interface{}, time ...int) error

Write 将数据data序列化后关联到给定key,time为key的超时时间(秒)

Jump to

Keyboard shortcuts

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