CoreHighf

package
v5.1.37 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockerWait

type BlockerWait struct {

	//等待时间
	// 支持1-300秒范围,超出范围将自动回归数据
	// 时间不能超过5分钟,避免主线程序线程耗尽
	// 如果没有初始化,默认按5秒计算
	WaitTime int
	// contains filtered or unexported fields
}

BlockerWait 等待拦截器 * 1. 本模块用于持久性拦截一些重复请求,减少服务器压力。 2. 可用于统计数据拦截,当统计请求收到后,用此模块拦截处理,避免重复触发统计。

func (*BlockerWait) Check

func (t *BlockerWait) Check(modID int64, modMark string) (isNewData bool, b bool)

Check 检查是否通行? isNewData 用于说明是新的数据,方便拦截器识别处理 b 用于说明是否通行,如果通行则需执行后续业务逻辑,否则请勿执行

func (*BlockerWait) CheckWait

func (t *BlockerWait) CheckWait(modID int64, modMark string, handle func(modID int64, modMark string))

CheckWait 阻塞检查程序 将程序永久化阻塞,满足条件时释放 释放如果b=false则说明已经存在数据,需跳出,避免线程过多

func (*BlockerWait) Init

func (t *BlockerWait) Init(waitTime int)

Init 初始化

type HighFBlocker

type HighFBlocker struct {
	//间隔时间秒
	WaitSec int64
	//是否仅拦截相同数据
	OnlySameData bool
	// contains filtered or unexported fields
}

HighFBlocker nats拦截器 拦截器主要阻拦不必要的消费处理,如高频数据等,一些敏感数据请勿使用

func (*HighFBlocker) Check

func (t *HighFBlocker) Check(id int64, mark string, data string) bool

Check 检查是否是否可通行

func (*HighFBlocker) Init

func (t *HighFBlocker) Init(waitSec int64, onlySameData bool)

Init 初始化

func (*HighFBlocker) Run

func (t *HighFBlocker) Run()

Run 运行拦截器

Jump to

Keyboard shortcuts

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