goredis

package
v0.0.0-...-c42b9c9 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_MAX_CONN      = 3500
	DEFAULT_MAX_IDEL_CONN = 3000
	DEFAULT_IDEL_TIMEOUT  = 300 * time.Second // 300  time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisCli

type RedisCli struct {
	RedisPool *redis.Client
}

RedisCli redis cli instance

func (*RedisCli) Decr

func (p *RedisCli) Decr(pool, key string) (string, error)

Decr func Decrease

func (*RedisCli) DecrBy

func (p *RedisCli) DecrBy(key string, count int64) (int64, error)

DescBy func DescBy

func (*RedisCli) Delete

func (p *RedisCli) Delete(key string) error

Delete delete a kye

func (*RedisCli) Exists

func (p *RedisCli) Exists(key string) bool

Exists check a key

func (*RedisCli) Expire

func (p *RedisCli) Expire(key string, expire time.Duration) bool

Expire func Expire(True: key存在,设置过期时间成功 / False: key不存在,设置过期时间失败)

func (*RedisCli) Get

func (p *RedisCli) Get(key string) (string, error)

Get get a key

func (*RedisCli) Incr

func (p *RedisCli) Incr(key string) (string, error)

Incr func Increase

func (*RedisCli) IncrBy

func (p *RedisCli) IncrBy(key string, count int64) (int64, error)

IncrBy func incrBy

func (*RedisCli) LPop

func (p *RedisCli) LPop(key string) (string, error)

LPop pop

func (*RedisCli) LRange

func (p *RedisCli) LRange(key string, begin, end int) ([]string, error)

LRange LRange LRange

func (*RedisCli) RPush

func (p *RedisCli) RPush(key string, value ...string) (int64, error)

RPush Push back

func (*RedisCli) Set

func (p *RedisCli) Set(key, value string, expireTime time.Duration) error

Set key,value,time

func (*RedisCli) SetNX

func (p *RedisCli) SetNX(key, value string, expireTime time.Duration) error

SetNX a key/value 已存在返回错误信息

func (*RedisCli) TTL

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

TTL get the key remain expire time(-2: 表示key不存在 / -1表示key没有过期时间)

type RedisFactory

type RedisFactory struct {
	MaxIdleConn int
	MaxConn     int
	IdleTimeout time.Duration
}

RedisFactory struct

var (
	Factory RedisFactory
)

func (*RedisFactory) CreateRedisCli

func (p *RedisFactory) CreateRedisCli(pwd, url string) (*RedisCli, error)

CreateRedisCli func create redis cli

Jump to

Keyboard shortcuts

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