Documentation
¶
Index ¶
- Constants
- func Dict(ctx context.Context, name DictName, key string) (string, error)
- func InitCache(m *Memory, r *Redis)
- func InitMemory(opts ...MemoryOption)
- func InitRedis(opts ...RedisOption)
- func NewDict(name DictName, query DictQuery, ttl ...time.Duration)
- func Ptr[T any](v T) *T
- func Val[T any](v *T) T
- func WithSkipPrefix(ctx context.Context) context.Context
- type Cache
- type DelayQueue
- func (q *DelayQueue) DisableListener()
- func (q *DelayQueue) DisableReport()
- func (q *DelayQueue) EnableReport()
- func (q *DelayQueue) GetPendingCount() (int64, error)
- func (q *DelayQueue) GetProcessingCount() (int64, error)
- func (q *DelayQueue) GetReadyCount() (int64, error)
- func (q *DelayQueue) ListenEvent(listener EventListener)
- func (q *DelayQueue) SendDelayMsg(payload string, duration time.Duration) (string, error)
- func (q *DelayQueue) SendScheduleMsg(payload string, t time.Time) (string, error)
- func (q *DelayQueue) Stop()
- func (q *DelayQueue) Subscribe(cb func(payload string) bool) (done <-chan struct{})
- func (q *DelayQueue) TryIntercept(id string) (*InterceptResult, error)
- type DictName
- type DictQuery
- type Event
- type EventListener
- type EventType
- type InterceptResult
- type MemEntry
- type Memory
- func (m *Memory) Capacity() int
- func (m *Memory) Close() error
- func (m *Memory) Delete(key string)
- func (m *Memory) Get(key string) (string, bool)
- func (m *Memory) KeyMetadata(key string) bigcache.Metadata
- func (m *Memory) Len() int
- func (m *Memory) Range(fn func(key string, value string))
- func (m *Memory) Set(key string, value string, ttl ...time.Duration)
- func (m *Memory) Stats() bigcache.Stats
- type MemoryOption
- type Monitor
- type Prefix
- type PrefixHook
- type Publisher
- type QueueOption
- func WithQueueConcurrent(concurrent uint) QueueOption
- func WithQueueDefaultTTL(ttl time.Duration) QueueOption
- func WithQueueFetchInterval(interval time.Duration) QueueOption
- func WithQueueFetchLimit(limit uint) QueueOption
- func WithQueueHashTag(hashTag bool) QueueOption
- func WithQueueMaxConsumeDuration(duration time.Duration) QueueOption
- func WithQueueNackRedeliveryDelay(delay time.Duration) QueueOption
- func WithQueueRetryCount(count uint) QueueOption
- type Redis
- type RedisOption
- type Topic
Constants ¶
View Source
const ( StatePending = "pending" StateReady = "ready" StateReadyRetry = "ready_to_retry" StateConsuming = "consuming" StateUnknown = "unknown" )
Variables ¶
This section is empty.
Functions ¶
func InitMemory ¶
func InitMemory(opts ...MemoryOption)
func InitRedis ¶
func InitRedis(opts ...RedisOption)
Types ¶
type DelayQueue ¶
type DelayQueue struct {
// contains filtered or unexported fields
}
func NewQueue ¶
func NewQueue(topic Topic, opts ...QueueOption) *DelayQueue
func (*DelayQueue) DisableListener ¶
func (q *DelayQueue) DisableListener()
func (*DelayQueue) DisableReport ¶
func (q *DelayQueue) DisableReport()
func (*DelayQueue) EnableReport ¶
func (q *DelayQueue) EnableReport()
func (*DelayQueue) GetPendingCount ¶
func (q *DelayQueue) GetPendingCount() (int64, error)
func (*DelayQueue) GetProcessingCount ¶
func (q *DelayQueue) GetProcessingCount() (int64, error)
func (*DelayQueue) GetReadyCount ¶
func (q *DelayQueue) GetReadyCount() (int64, error)
func (*DelayQueue) ListenEvent ¶
func (q *DelayQueue) ListenEvent(listener EventListener)
func (*DelayQueue) SendDelayMsg ¶
func (*DelayQueue) SendScheduleMsg ¶
func (*DelayQueue) Stop ¶
func (q *DelayQueue) Stop()
func (*DelayQueue) Subscribe ¶
func (q *DelayQueue) Subscribe(cb func(payload string) bool) (done <-chan struct{})
func (*DelayQueue) TryIntercept ¶
func (q *DelayQueue) TryIntercept(id string) (*InterceptResult, error)
type EventListener ¶
type EventListener interface {
OnEvent(*Event)
}
type InterceptResult ¶
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
func NewMemory ¶
func NewMemory(opts ...MemoryOption) *Memory
type MemoryOption ¶
type MemoryOption func(*memoryOptions)
func WithMemoryOptions ¶
func WithMemoryOptions(options *bigcache.Config) MemoryOption
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
func NewMonitor ¶
func NewMonitor(topic Topic, opts ...QueueOption) *Monitor
func (*Monitor) GetPendingCount ¶
func (*Monitor) GetProcessingCount ¶
func (*Monitor) GetReadyCount ¶
func (*Monitor) ListenEvent ¶
func (m *Monitor) ListenEvent(listener EventListener) (func(), error)
type PrefixHook ¶
type PrefixHook struct {
// contains filtered or unexported fields
}
func NewPrefixHook ¶
func NewPrefixHook(prefix Prefix) *PrefixHook
func (PrefixHook) ProcessHook ¶
func (h PrefixHook) ProcessHook(next redis.ProcessHook) redis.ProcessHook
func (PrefixHook) ProcessPipelineHook ¶
func (h PrefixHook) ProcessPipelineHook(next redis.ProcessPipelineHook) redis.ProcessPipelineHook
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
func NewPublisher ¶
func NewPublisher(topic Topic, opts ...QueueOption) *Publisher
func (*Publisher) SendDelayMsg ¶
type QueueOption ¶
type QueueOption func(*queueOptions)
func WithQueueConcurrent ¶
func WithQueueConcurrent(concurrent uint) QueueOption
func WithQueueDefaultTTL ¶
func WithQueueDefaultTTL(ttl time.Duration) QueueOption
func WithQueueFetchInterval ¶
func WithQueueFetchInterval(interval time.Duration) QueueOption
func WithQueueFetchLimit ¶
func WithQueueFetchLimit(limit uint) QueueOption
func WithQueueHashTag ¶
func WithQueueHashTag(hashTag bool) QueueOption
func WithQueueMaxConsumeDuration ¶
func WithQueueMaxConsumeDuration(duration time.Duration) QueueOption
func WithQueueNackRedeliveryDelay ¶
func WithQueueNackRedeliveryDelay(delay time.Duration) QueueOption
func WithQueueRetryCount ¶
func WithQueueRetryCount(count uint) QueueOption
type Redis ¶
type Redis struct {
redis.UniversalClient
// contains filtered or unexported fields
}
func NewRedis ¶
func NewRedis(opts ...RedisOption) *Redis
func (*Redis) BatchDelete ¶
BatchDelete @Description: 批量删除 @receiver r @param ctx @param pattern 匹配模式,如foo* 表示匹配foo开头的所有key @param batchSize 单次批量删除的数量 @return int64 @return error
type RedisOption ¶
type RedisOption func(*redisOptions)
func WithRedisOptions ¶
func WithRedisOptions(redis *redis.UniversalOptions) RedisOption
func WithRedisPrefix ¶
func WithRedisPrefix(prefix string) RedisOption
Click to show internal directories.
Click to hide internal directories.