Documentation
¶
Overview ¶
cellhelper redis扩展[redis-cell](https://github.com/brandur/redis-cell)帮助模块,用于返回令牌桶状态
Index ¶
- Variables
- func WithAutoRefreshInterval(autoRefreshInterval string) optparams.Option[Options]
- func WithCountPerPeriod(countPerPeriod int64) optparams.Option[Options]
- func WithKey(key string) optparams.Option[Options]
- func WithMaxBurst(maxBurst int64) optparams.Option[Options]
- func WithMaxTTL(maxTTL time.Duration) optparams.Option[Options]
- func WithMiddlewaretype(typename string) optparams.Option[Options]
- func WithNamespace(ns ...string) optparams.Option[Options]
- func WithPeriod(period int64) optparams.Option[Options]
- func WithSpecifiedKey(key string) optparams.Option[Options]
- func WithTaskCron(taskCron *cron.Cron) optparams.Option[Options]
- type Options
- type RedisCell
- type RedisCellStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var Defaultopt = Options{ Middlewaretype: "redis-cell", MaxBurst: 99, CountPerPeriod: 30, Period: 60, MiddlewareOpts: []optparams.Option[middlewarehelper.Options]{}, }
Functions ¶
func WithAutoRefreshInterval ¶
WithAutoRefreshInterval 设置自动刷新过期时间的设置
func WithCountPerPeriod ¶
WithCountPerPeriod 设置时间间隔内的token消减数
func WithMaxBurst ¶
WithMaxBurst 设置最大熔断数,最大token数为MaxBurst+1
func WithMaxTTL ¶
WithMaxTTL 设置token消减间隔时长,单位s
func WithMiddlewaretype ¶
WithMiddlewaretype 设置中间件类型
func WithNamespace ¶
WithNamespace 中间件通用设置,指定锁的命名空间
func WithPeriod ¶
WithPeriod 设置token消减间隔时长,单位s
func WithSpecifiedKey ¶
WithSpecifiedKey 中间件通用设置,指定使用的键,注意设置key后namespace将失效
func WithTaskCron ¶
WithTaskCron 设置定时器
Types ¶
type Options ¶
type Options struct { Middlewaretype string MaxBurst int64 CountPerPeriod int64 Period int64 MiddlewareOpts []optparams.Option[middlewarehelper.Options] //初始化Middleware的配置 }
Options broker的配置
type RedisCell ¶
type RedisCell struct { *middlewarehelper.MiddleWareAbc // contains filtered or unexported fields }
RedisCell 令牌桶对象
func (*RedisCell) ClThrottle ¶
ClThrottle 增加桶中token数并返回桶状态 @params count int64 增加的token数量
Click to show internal directories.
Click to hide internal directories.