Count returns the number of elements within the map.
()
| 79 | |
| 80 | // Count returns the number of elements within the map. |
| 81 | func (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. |
| 93 | func (slm ShardLockMaps) Get(key string) (interface{}, bool) { |
no outgoing calls