Documentation
¶
Index ¶
- Variables
- func Context() context.Context
- func GetContextWithCancel() (context.Context, context.CancelFunc)
- func Shutdown()
- func WaitForShutdown()
- type Channel
- type PeriodicOncedeprecated
- type RollingMutexdeprecated
- type RollingOnce
- func (o *RollingOnce) Close()
- func (o *RollingOnce) Do(f func())
- func (o *RollingOnce) GetCurrentAnchorPoint() int64
- func (o *RollingOnce) Reset()
- func (o *RollingOnce) SetOffsetForZero(offsetMilliSeconds int64)
- func (o *RollingOnce) SetOffsetTime(hour, minute int)
- func (o *RollingOnce) WindowIsExpired() bool
- type RollingWaitGroup
- type SpinLock
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrChannelClosed = errors.New("channel closed") ErrBufferFull = errors.New("buffer full") )
Functions ¶
func GetContextWithCancel ¶ added in v1.11.5
func GetContextWithCancel() (context.Context, context.CancelFunc)
Types ¶
type Channel ¶ added in v1.19.3
type Channel[E any] struct { // contains filtered or unexported fields }
func NewChannel ¶ added in v1.22.11
type PeriodicOnce
deprecated
added in
v1.12.3
type PeriodicOnce struct {
// contains filtered or unexported fields
}
PeriodicOnce 周期性懒加载机制
Deprecated: 推荐 RollingOnce [wangfeng on 2024/1/22 10:33]
func (*PeriodicOnce) Do ¶ added in v1.12.3
func (o *PeriodicOnce) Do(f func())
type RollingMutex
deprecated
type RollingMutex struct {
// contains filtered or unexported fields
}
RollingMutex 按指定rolling策略加锁, 指定周期内只加载一次
滑动窗口锁, 窗口期内只初始化一次, 目前只支持1天切换
Deprecated: 不推荐, 建议使用 RollingOnce
func (*RollingMutex) Date ¶
func (o *RollingMutex) Date() string
func (*RollingMutex) Do ¶
func (o *RollingMutex) Do(f func(), today ...func() (newDate string))
func (*RollingMutex) Reset ¶
func (o *RollingMutex) Reset()
type RollingOnce ¶ added in v1.16.8
type RollingOnce struct {
// contains filtered or unexported fields
}
RollingOnce 周期性懒加载机制
func (*RollingOnce) Do ¶ added in v1.16.8
func (o *RollingOnce) Do(f func())
func (*RollingOnce) GetCurrentAnchorPoint ¶ added in v1.19.1
func (o *RollingOnce) GetCurrentAnchorPoint() int64
GetCurrentAnchorPoint 获取当前时间窗口期的锚点
func (*RollingOnce) SetOffsetForZero ¶ added in v1.18.1
func (o *RollingOnce) SetOffsetForZero(offsetMilliSeconds int64)
SetOffsetForZero 设置时间窗口变化的偏移量
为非默认9点整重置done预留的功能性方法
func (*RollingOnce) SetOffsetTime ¶ added in v1.18.2
func (o *RollingOnce) SetOffsetTime(hour, minute int)
SetOffsetTime 用小时数,分钟数设置滑动窗口的偏移量
func (*RollingOnce) WindowIsExpired ¶ added in v1.19.2
func (o *RollingOnce) WindowIsExpired() bool
WindowIsExpired 检查当前窗口期的是否过期
type RollingWaitGroup ¶ added in v1.14.2
type RollingWaitGroup struct {
// contains filtered or unexported fields
}
RollingWaitGroup 滑动窗口n的WaitGroup
func NewRollingWaitGroup ¶ added in v1.14.2
func NewRollingWaitGroup(n int) *RollingWaitGroup
NewRollingWaitGroup initialization RollingWaitGroup struct
func (*RollingWaitGroup) Add ¶ added in v1.14.2
func (g *RollingWaitGroup) Add(delta int)
func (*RollingWaitGroup) Done ¶ added in v1.14.2
func (g *RollingWaitGroup) Done()
func (*RollingWaitGroup) Wait ¶ added in v1.14.2
func (g *RollingWaitGroup) Wait()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.