rdb

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Nil = redis.Nil
)

Functions

func Connect

func Connect(cfg *Config, force ...bool) error

func FlagSet

func FlagSet(name string) *pflag.FlagSet

func Init

func Init(cfg *Config, force ...bool) error

func NoiseCheck

func NoiseCheck(ctx context.Context, key string, count int64, expire time.Duration) (bool, int64)

func NoiseGet

func NoiseGet(ctx context.Context, key string) int64

func NoiseSet

func NoiseSet(ctx context.Context, key string, expire time.Duration) int64

func R

func R() *redis.Client

Types

type Config

type Config struct {
	Debug bool   `json:"debug" yaml:"debug"`
	Host  string `json:"host" yaml:"host"`
	Port  int    `json:"port" yaml:"port"`
	DB    int    `json:"db" yaml:"db"`
	Pass  string `json:"pass" yaml:"pass"`
}

type DebugHook

type DebugHook struct{}

func (DebugHook) DialHook

func (DebugHook) DialHook(next redis.DialHook) redis.DialHook

当创建网络连接时调用

func (DebugHook) ProcessHook

func (DebugHook) ProcessHook(next redis.ProcessHook) redis.ProcessHook

执行命令时调用

func (DebugHook) ProcessPipelineHook

func (DebugHook) ProcessPipelineHook(next redis.ProcessPipelineHook) redis.ProcessPipelineHook

执行管道命令时调用

type Task

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

func NewTask

func NewTask(taskKey string, maxRetryCount int64) *Task

func (*Task) Add

func (t *Task) Add(ctx context.Context, prefix, key string, executeAt int64) error

func (*Task) List

func (t *Task) List(ctx context.Context) (TaskItems, error)

func (*Task) Process

func (t *Task) Process(ctx context.Context, f func(string) error)

func (*Task) Remove

func (t *Task) Remove(ctx context.Context, key string) error

func (*Task) Start

func (t *Task) Start(ctx context.Context, f func(string) error)

type TaskItem

type TaskItem struct {
	Key   string
	Score int64
}

type TaskItems

type TaskItems []*TaskItem

func (*TaskItems) String

func (t *TaskItems) String() string

Jump to

Keyboard shortcuts

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