redis

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 16 Imported by: 6

Documentation

Index

Constants

View Source
const (
	DELAY_QUEUE_NAME = "glue:delayqueue:list"
)
View Source
const (
	Proto = "redis"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

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

Consumer Consumer

func NewConsumer

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

NewConsumerByConfig 创建新的Consumer

func (*Consumer) Close

func (consumer *Consumer) Close()

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()

Start 启动

func (*Consumer) Unconsume

func (consumer *Consumer) Unconsume(queue string)

UnConsume 取消注册消费

type MsgBody

type MsgBody struct {
	QueueKey  string      `json:"queuekey"`
	HeaderMap xtypes.SMap `json:"header"`
	BodyMap   xtypes.XMap `json:"body"`
	// contains filtered or unexported fields
}

func (*MsgBody) Body

func (m *MsgBody) Body() map[string]interface{}

func (*MsgBody) Header

func (m *MsgBody) Header() map[string]string

func (*MsgBody) String

func (m *MsgBody) String() string

type Producer

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

Producer memcache配置文件

func NewProducer

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

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

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 {
	DelayQueueName string `json:"delay_queue_name" yaml:"delay_queue_name"`
	RangeSeconds   int    `json:"range_seconds" yaml:"range_seconds"`
	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
}

func (*QueueItem) CloseMsgChan added in v0.2.0

func (qi *QueueItem) CloseMsgChan()

Jump to

Keyboard shortcuts

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