Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnyCache ¶
type AnyCache[T comparable] struct { // contains filtered or unexported fields }
Cache 一个可并发、防击穿的LRU算法 最小长度缓存为1,达到缓存上限时,淘汰最久未访问的数据 直接使用时,自动使用最小缓存长度
func NewAnyCache ¶
func NewAnyCache[T comparable](maxCacheLen uint16, outTime time.Duration) *AnyCache[T]
NewCache 根据输入缓存长度生成AnyCache对象
func (*AnyCache[T]) LoadOrStore ¶
LoadOrStore 根据key读取数据,当没有数据时,根据输入的方法存储并返回数据
type Cache ¶
type Cache[T1, T2 comparable] struct { // contains filtered or unexported fields }
Cache 一个可并发、防击穿的LRU算法 最小长度缓存为1,达到缓存上限时,淘汰最久未访问的数据 直接使用时,自动使用最小缓存长度
func NewCache ¶
func NewCache[T1, T2 comparable](maxCacheLen uint16, outTime time.Duration) *Cache[T1, T2]
NewCache 根据输入缓存长度生成Cache对象
func (*Cache[T1, T2]) LoadOrStore ¶
LoadOrStore 根据key读取数据,当没有数据时,根据输入的方法存储并返回数据
type CancelMgr ¶
type CancelMgr[T comparable] struct { // contains filtered or unexported fields }
用于超时任务操作集
func NewCancelMgr ¶
func NewCancelMgr[T comparable]() *CancelMgr[T]
func (*CancelMgr[T]) Store ¶
func (i *CancelMgr[T]) Store(key T, value context.CancelFunc)
type MulSet ¶
type MulSet[T comparable] struct { sync.RWMutex // contains filtered or unexported fields }
可重复插入的Set,一般用于作为任务锁
func NewMulSet ¶
func NewMulSet[T comparable]() *MulSet[T]
Click to show internal directories.
Click to hide internal directories.