Documentation
¶
Index ¶
Constants ¶
View Source
const (
// DefaultPoolSize 提供分配共享池大小的默认值
DefaultPoolSize = 1 << 5
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcurrencyElement ¶
type ConcurrencyElement struct {
Key interface{}
Value interface{}
}
ConcurrencyElement 存储的元素项
type ConcurrencyMap ¶
type ConcurrencyMap interface {
// Get 获取给定键值对应的元素值。若没有对应的元素值则返回nil
Get(key interface{}) (interface{}, error)
// Set 给指定的键设置元素值。若该键值已存在,则替换
Set(key interface{}, elem interface{}) error
// SetIfAbsent 给指定的键设置元素值。
// 若该键值已存在,则不替换,并返回已经存在的值同时返回false
// 若改键值不存在,则增加该键值同时返回true
SetIfAbsent(key interface{}, elem interface{}) (interface{}, bool)
// Remove 删除给定键值对应的键值对,并返回旧的元素值。若没有旧元素的值则返回nil
Remove(key interface{}) (interface{}, error)
// Contains 判断是否包含给定的键值
Contains(key interface{}) (bool, error)
// Clear 清除所有的键值对
Clear()
// Len 获取键值对的数量
Len() int
// ToMap 获取已包含的键值对所组成的字典值
ToMap() map[interface{}]interface{}
// Elements 获取并发Map中的元素
Elements() <-chan ConcurrencyElement
// Keys 获取所有的键数据
Keys() []interface{}
// Values 获取所有的值数据
Values() []interface{}
}
ConcurrencyMap 并发的Map接口
func NewConcurrencyMap ¶
func NewConcurrencyMap(poolSizes ...uint) ConcurrencyMap
NewConcurrencyMap 创建并发的Map接口 poolSize 分配共享池的大小,默认为32
Click to show internal directories.
Click to hide internal directories.