Documentation ¶
Index ¶
- func InArray[T comparable](arr []T, key T) bool
- type ConcurrentMap
- func (container *ConcurrentMap[Key, T]) Del(key Key)
- func (container *ConcurrentMap[Key, T]) Find(key Key) (item T, err error)
- func (container *ConcurrentMap[Key, T]) Get(key Key) (item T, exist bool)
- func (container *ConcurrentMap[Key, T]) Iterator(fn func(key Key, val T))
- func (container *ConcurrentMap[Key, T]) Len() int
- func (container *ConcurrentMap[Key, T]) Set(key Key, value T)
- type DelayQueue
- type KeyType
- type LockFreeMap
- func (container *LockFreeMap[Key, T]) Del(key Key)
- func (container *LockFreeMap[Key, T]) Find(key Key) (item T, err error)
- func (container *LockFreeMap[Key, T]) Get(key Key) (item T, exist bool)
- func (container *LockFreeMap[Key, T]) Iterator(fn func(key Key, val T))
- func (container *LockFreeMap[Key, T]) Len() int
- func (container *LockFreeMap[Key, T]) Set(key Key, value T)
- type Map
- type Queue
- type Sharding
- type Singleton
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InArray ¶ added in v1.1.8
func InArray[T comparable](arr []T, key T) bool
Types ¶
type ConcurrentMap ¶
ConcurrentMap represents safe concurrent map container
func NewConcurrentMap ¶
func NewConcurrentMap[Key KeyType, T any]() *ConcurrentMap[Key, T]
func (*ConcurrentMap[Key, T]) Del ¶ added in v1.1.5
func (container *ConcurrentMap[Key, T]) Del(key Key)
Del remove keys from container
func (*ConcurrentMap[Key, T]) Find ¶
func (container *ConcurrentMap[Key, T]) Find(key Key) (item T, err error)
Find returns item if key is not exist, returns not found error
func (*ConcurrentMap[Key, T]) Get ¶
func (container *ConcurrentMap[Key, T]) Get(key Key) (item T, exist bool)
Get return item and exist
func (*ConcurrentMap[Key, T]) Iterator ¶ added in v1.1.8
func (container *ConcurrentMap[Key, T]) Iterator(fn func(key Key, val T))
func (*ConcurrentMap[Key, T]) Len ¶ added in v1.1.8
func (container *ConcurrentMap[Key, T]) Len() int
func (*ConcurrentMap[Key, T]) Set ¶
func (container *ConcurrentMap[Key, T]) Set(key Key, value T)
Set sets map item
type DelayQueue ¶ added in v1.2.0
type DelayQueue struct { Data chan interface{} // 通过channel的方式输出数据,保证有序性 // contains filtered or unexported fields }
DelayQueue 延时队列
func NewDelayQueue ¶ added in v1.2.0
func NewDelayQueue(size int) *DelayQueue
func (*DelayQueue) Offer ¶ added in v1.2.0
func (dq *DelayQueue) Offer(elem interface{}, expiration int64)
Offer 插入一个数据以及设置其出列的时间
func (*DelayQueue) Poll ¶ added in v1.2.0
func (dq *DelayQueue) Poll(nowF func() int64)
Poll 根据时间函数读取队列数据
type LockFreeMap ¶ added in v1.1.9
func NewLockFreeMap ¶ added in v1.1.9
func NewLockFreeMap[Key KeyType, T any]() *LockFreeMap[Key, T]
func (*LockFreeMap[Key, T]) Del ¶ added in v1.1.9
func (container *LockFreeMap[Key, T]) Del(key Key)
Del remove keys from container
func (*LockFreeMap[Key, T]) Find ¶ added in v1.1.9
func (container *LockFreeMap[Key, T]) Find(key Key) (item T, err error)
Find returns item if key is not exist, returns not found error
func (*LockFreeMap[Key, T]) Get ¶ added in v1.1.9
func (container *LockFreeMap[Key, T]) Get(key Key) (item T, exist bool)
Get return item and exist
func (*LockFreeMap[Key, T]) Iterator ¶ added in v1.1.9
func (container *LockFreeMap[Key, T]) Iterator(fn func(key Key, val T))
func (*LockFreeMap[Key, T]) Len ¶ added in v1.1.9
func (container *LockFreeMap[Key, T]) Len() int
func (*LockFreeMap[Key, T]) Set ¶ added in v1.1.9
func (container *LockFreeMap[Key, T]) Set(key Key, value T)
Set sets map item
type Queue ¶ added in v1.1.7
type Queue[T any] struct { // contains filtered or unexported fields }
Queue represents a queue of any object
Source Files ¶
Click to show internal directories.
Click to hide internal directories.