redis

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultStorePrefix = "delay-queue"
	DefaultStoreName   = "timing-task"
)

Variables

This section is empty.

Functions

func NewConfig

func NewConfig(opts ...ConfigOption) *config

func NewGenerateLoseStore

func NewGenerateLoseStore(tws *TWStore) *generateLoseStore

func NewMapStore

func NewMapStore(rp *redis.Pool, opts ...ConfigOption) *mapStore

func NewReadyQueue

func NewReadyQueue(rp *redis.Pool, store role.DataStore, opts ...ConfigOption) *readyQueue

func NewStatusStore

func NewStatusStore(rp *redis.Pool, opts ...ConfigOption) *statusStore

Types

type ConfigOption

type ConfigOption func(*config)

func ConfigWithConvert

func ConfigWithConvert(convert role.PbConvertTask) ConfigOption

func ConfigWithCopy

func ConfigWithCopy(cp xcopy.XCopy) ConfigOption

func ConfigWithId

func ConfigWithId(id string) ConfigOption

func ConfigWithName

func ConfigWithName(name string) ConfigOption

func ConfigWithPrefix

func ConfigWithPrefix(prefix string) ConfigOption

type Send

type Send func(commandName string, args ...interface{}) error

type SortedSet

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

外部注入 TASK STORE (ZSET)

func NewSortedSet

func NewSortedSet(rp *redis.Pool, store role.DataStore, opts ...ConfigOption) *SortedSet

func (*SortedSet) Add

func (s *SortedSet) Add(t task.Task) error

func (*SortedSet) Get

func (s *SortedSet) Get(uid string) task.Task

func (*SortedSet) Len

func (s *SortedSet) Len() int

func (*SortedSet) MultiRemove

func (s *SortedSet) MultiRemove(uids []string) error

func (*SortedSet) Range

func (s *SortedSet) Range(st time.Duration, limit int) []task.Task

func (*SortedSet) Release

func (s *SortedSet) Release()

func (*SortedSet) Remove

func (s *SortedSet) Remove(uid string) error

type TWStore

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

为了方便重载数据单独提供一个存储

func NewTWStore

func NewTWStore(rp *redis.Pool, opts ...ConfigOption) *TWStore

func (TWStore) IncrRetryTimes

func (s TWStore) IncrRetryTimes(uid string, num int) error

func (TWStore) IncrSendTimes

func (s TWStore) IncrSendTimes(uid string, num int) error

func (*TWStore) Insert

func (tws *TWStore) Insert(t *model.Task) error

重置添加和删除逻辑

func (*TWStore) InsertMany

func (tws *TWStore) InsertMany(ts []*model.Task) error

func (TWStore) NextTime

func (s TWStore) NextTime(uid string, nt *time.Time) error

func (*TWStore) Remove

func (tws *TWStore) Remove(uid string) error

func (*TWStore) RemoveMany

func (tws *TWStore) RemoveMany(uids []string) error

func (*TWStore) Status

func (tws *TWStore) Status(uid string, tt pb.TaskType) error

func (*TWStore) Transaction

func (tws *TWStore) Transaction(fn func(role.DataStore) error) (err error)

type TWStoreTrans

type TWStoreTrans struct {
	*TWStore
	// contains filtered or unexported fields
}

func (*TWStoreTrans) IncrRetryTimes

func (st *TWStoreTrans) IncrRetryTimes(uid string, num int) error

func (*TWStoreTrans) IncrSendTimes

func (st *TWStoreTrans) IncrSendTimes(uid string, num int) error

func (*TWStoreTrans) Insert

func (st *TWStoreTrans) Insert(t *model.Task) error

主要实现修改相关操作

func (*TWStoreTrans) InsertMany

func (st *TWStoreTrans) InsertMany(ts []*model.Task) error

func (*TWStoreTrans) NextTime

func (st *TWStoreTrans) NextTime(uid string, nt *time.Time) error

func (*TWStoreTrans) Remove

func (st *TWStoreTrans) Remove(uid string) error

func (*TWStoreTrans) RemoveMany

func (st *TWStoreTrans) RemoveMany(uids []string) error

func (*TWStoreTrans) Status

func (st *TWStoreTrans) Status(uid string, tt pb.TaskType) error

Jump to

Keyboard shortcuts

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