Documentation
¶
Index ¶
- Constants
- type ConcurrentMap
- func (m ConcurrentMap) Count() int
- func (m ConcurrentMap) Get(key string) (value interface{}, ok bool)
- func (m ConcurrentMap) GetSharedMap(key string) *ConcurrentMapShared
- func (m ConcurrentMap) Keys1() []string
- func (m ConcurrentMap) Keys2() []string
- func (m ConcurrentMap) Set(key string, value interface{})
- type ConcurrentMapShared
- type MutexMap
Constants ¶
View Source
const SHARE_COUNT int = 64
SHARE_COUNT 默认分片数
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcurrentMap ¶
type ConcurrentMap []*ConcurrentMapShared
ConcurrentMap 总的map
func (ConcurrentMap) Get ¶
func (m ConcurrentMap) Get(key string) (value interface{}, ok bool)
Get 获取key对应的value
func (ConcurrentMap) GetSharedMap ¶
func (m ConcurrentMap) GetSharedMap(key string) *ConcurrentMapShared
GetSharedMap 获取key对应的map分片
func (ConcurrentMap) Keys1 ¶
func (m ConcurrentMap) Keys1() []string
Keys1 所有的key方法1(方法:遍历每个分片map,读取key;缺点:量大时,阻塞时间较长)
func (ConcurrentMap) Keys2 ¶
func (m ConcurrentMap) Keys2() []string
Keys2 所有的key方法2(方法:开多个协程分别对分片map做统计再汇总 优点:量大时,阻塞时间较短)
func (ConcurrentMap) Set ¶
func (m ConcurrentMap) Set(key string, value interface{})
Set 设置key,value
type ConcurrentMapShared ¶
type ConcurrentMapShared struct {
// contains filtered or unexported fields
}
ConcurrentMapShared 单个map分片
Click to show internal directories.
Click to hide internal directories.