redis

package
v0.5.24 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 15 Imported by: 6

Documentation

Index

Constants

View Source
const (
	Proto = "redis"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	EnableDeadLetter bool //开启死信队列
	DeadLetterQueue  string
	// contains filtered or unexported fields
}

Consumer Consumer

func NewConsumer

func NewConsumer(configName string, config config.Config) (consumer *Consumer, err error)

NewConsumerByConfig 创建新的Consumer

func (*Consumer) Close

func (consumer *Consumer) Close() error

Close 关闭当前连接

func (*Consumer) Connect

func (consumer *Consumer) Connect() (err error)

Connect 连接服务器

func (*Consumer) Consume

func (consumer *Consumer) Consume(task queue.TaskInfo, callback queue.ConsumeCallback) (err error)

Consume 注册消费信息

func (*Consumer) Start

func (consumer *Consumer) Start() error

Start 启动

func (*Consumer) Unconsume

func (consumer *Consumer) Unconsume(queue string)

UnConsume 取消注册消费

type Producer

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

Producer memcache配置文件

func NewProducer

func NewProducer(config config.Config, opts ...queue.Option) (m *Producer, err error)

NewProducerByConfig 根据配置文件创建一个redis连接

func (*Producer) BatchPush added in v0.4.6

func (p *Producer) BatchPush(key string, msgList ...queue.Message) error

func (*Producer) Close

func (c *Producer) Close() error

Close 释放资源

func (*Producer) Count

func (c *Producer) Count(key string) (int64, error)

Count 获取列表中的元素个数

func (*Producer) DelayPush added in v0.1.19

func (c *Producer) DelayPush(key string, msg queue.Message, delaySeconds int64) error

Push 向存于 key 的列表的尾部插入所有指定的值

func (*Producer) Pop

func (c *Producer) Pop(key string) (string, error)

Pop 移除并且返回 key 对应的 list 的第一个元素。

func (*Producer) Push

func (c *Producer) Push(key string, msg queue.Message) error

Push 向存于 key 的列表的尾部插入所有指定的值

type ProductOptions added in v0.1.19

type ProductOptions struct {
	DelayInterval int `json:"delay_interval" yaml:"delay_interval"`
}

type QueueItem

type QueueItem struct {
	QueueName    string
	Concurrency  int //等于0 ,代表不限制
	BlockTimeout int
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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