Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MessageStore ¶
type MessageStore interface { //添加将消息添加到存储 //无论消息是否添加到存储区,都返回true或false Add(msg interface{}) bool //检查消息是否可插入存储 //返回“真”或“假”消息是否可以添加到存储区 CheckValid(msg interface{}) bool //SIZE返回存储区中的邮件数量 Size() int //GET返回存储区中的所有消息 Get() []interface{} //停止所有相关的go例程 Stop() //清除清除接受的所有消息 //给定谓词 Purge(func(interface{}) bool) }
messagestore将消息添加到内部缓冲区。 当收到消息时,它可能: -添加到缓冲区 -由于缓冲区中已存在某些消息而被丢弃(已失效) -使缓冲区中已存在要丢弃的消息(无效) 当消息无效时,将对该消息调用InvalidationTrigger。
func NewMessageStore ¶
func NewMessageStore(pol common.MessageReplacingPolicy, trigger invalidationTrigger) MessageStore
new messagestore返回一个新的messagestore,并替换消息 策略和无效触发已通过。
func NewMessageStoreExpirable ¶
func NewMessageStoreExpirable(pol common.MessageReplacingPolicy, trigger invalidationTrigger, msgTTL time.Duration, externalLock func(), externalUnlock func(), externalExpire func(interface{})) MessageStore
newmessagestoreexpireable返回一个新的messagestore,并替换消息 策略和无效触发已通过。它支持在MSGTTL之后、在第一个外部过期期间过期的旧邮件 锁定,调用过期回调,释放外部锁。回调和外部锁可以为零。
Click to show internal directories.
Click to hide internal directories.