redisMq

package
v0.0.0-...-3208bda Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const RedisTestchannel1 = "test1"

redis pubsub 示例的订阅频道

View Source
const RedisTestchannel2 = "test2"

redis pubsub 示例的订阅频道

Variables

This section is empty.

Functions

func GetRedisConn

func GetRedisConn() redigo.Conn

从Redis连接池获取一个连接

func GetRedisPubSubConn

func GetRedisPubSubConn() *redigo.PubSubConn

从Redis连接池获取一个PubSub连接

func Publish

func Publish(channel string, msg interface{}) error

发布消息 @param channel string 发布频道 @param msg interface{} 发布的消息

func RedisMqInit

func RedisMqInit()

func Subscribe

func Subscribe(recMsgFuncs map[string]RecSubMsgFunc, channels ...interface{}) error

订阅并接收消息

func Unsubscribe

func Unsubscribe(channels ...interface{}) error

取消订阅

Types

type RecSubMsgFunc

type RecSubMsgFunc func(topic string, msg interface{}) error

订阅模式下的消息处理函数类型

type RedisList

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

实现GingerQueue接口的entity,使用redis list数据结构

var RedisQueue *RedisList

func GetRedisList

func GetRedisList(conn redigo.Conn) *RedisList

获取一个redis连接的 list队列

func (*RedisList) Pop

func (q *RedisList) Pop(keyName string) (interface{}, error)

单次弹出队列元素

func (*RedisList) Push

func (q *RedisList) Push(keyName string, msg interface{}) (int, error)

加入队列元素

func (*RedisList) Size

func (q *RedisList) Size(keyName string) (int, error)

Jump to

Keyboard shortcuts

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