redis

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RedisNil = redis.Nil

RedisNil is redis nil

Functions

func AddDelayQueue added in v0.1.7

func AddDelayQueue(queueKey string, i interface{}, delay time.Duration) error

AddDelayQueue

func AddPriorityQueue added in v0.1.10

func AddPriorityQueue(queueKey string, i interface{}, priority int64) error

AddPriorityQueue

func AddQueue added in v0.1.6

func AddQueue(queueKey string, i interface{}) error

AddQueue

func AddQueueByScore added in v0.1.11

func AddQueueByScore(queueKey string, i interface{}, score float64) error

AddQueueByScore

func AnyDo

func AnyDo(name string, expiration time.Duration) int

AnyDo

func DayDo

func DayDo(name string) int

DayDo 每天可执行次数

func DecrBy

func DecrBy(key string, value int64) *redis.IntCmd

DecrBy

func Del

func Del(keys ...string) *redis.IntCmd

Del

func Expire

func Expire(key string, expiration time.Duration) *redis.BoolCmd

Expire

func Get

func Get(key string) *redis.StringCmd

Get

func GetCacheKey

func GetCacheKey(key string) string

GetCacheKey is get cache key

func GetPrefix

func GetPrefix() string

GetPrefix is get prefix

func GetRedis

func GetRedis() *redis.Ring

创建一个 redis 连接

func Has

func Has(key string) bool

Has

func HourDo

func HourDo(name string) int

HourDo 每小时可执行次数

func IncrBy

func IncrBy(key string, value int64) *redis.IntCmd

IncrBy

func IncrByFloat

func IncrByFloat(key string, value float64) *redis.FloatCmd

IncrByFloat

func JsonGet

func JsonGet(key string, paths ...string) *redis.JSONCmd

JsonSet

func JsonSet

func JsonSet(key string, value any, expiration time.Duration) *redis.StatusCmd

JsonSet

func MonthDo

func MonthDo(name string) int

MonthDo 每月可执行次数

func Prefix

func Prefix(key string)

Prefix is set prefix

func RunQueue added in v0.1.6

func RunQueue(queueKey string, batchNum int, scoreMax float64, callback func([]byte) (interface{}, error), callbacks ...func([]interface{}) error)

// 批量处理

redis.RunQueue("task_queue", 10, "+inf", func(data []byte) (interface{}, error) {
	log.Infof("data: %s", string(data))
	return nil, nil
}, func(results []interface{}) error {
	// 在这里批量处理上面的返回结果
	log.Infof("results: %v", results)
	return nil
})

func Set

func Set(key string, value any, expiration time.Duration) *redis.StatusCmd

Set

func TTL

func TTL(key string) *redis.DurationCmd

TTL

Types

This section is empty.

Jump to

Keyboard shortcuts

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