MCPcopy Index your code
hub / github.com/aceld/zinx / Count

Method Count

zutils/shard_lock_map.go:81–90  ·  view source on GitHub ↗

Count returns the number of elements within the map.

()

Source from the content-addressed store, hash-verified

79
80// Count returns the number of elements within the map.
81func (slm ShardLockMaps) Count() int {
82 count := 0
83 for i := 0; i < slm.shardCount; i++ {
84 shard := slm.shards[i]
85 shard.RLock()
86 count += len(shard.items)
87 shard.RUnlock()
88 }
89 return count
90}
91
92// Get retrieves an element from map under given key.
93func (slm ShardLockMaps) Get(key string) (interface{}, bool) {

Callers 12

TestCreatMapFunction · 0.95
TestSetFunction · 0.95
TestCountFunction · 0.95
TestRemoveFunction · 0.95
TestClearFunction · 0.95
TestUnmarshalJSONFunction · 0.95
TestConcurrentFunction · 0.95
TestClearWithFuncLockFunction · 0.95
IsEmptyMethod · 0.95
KeysMethod · 0.95
ConnNumsMethod · 0.80
LenMethod · 0.80

Calls

no outgoing calls

Tested by 8

TestCreatMapFunction · 0.76
TestSetFunction · 0.76
TestCountFunction · 0.76
TestRemoveFunction · 0.76
TestClearFunction · 0.76
TestUnmarshalJSONFunction · 0.76
TestConcurrentFunction · 0.76
TestClearWithFuncLockFunction · 0.76