MCPcopy Create free account
hub / github.com/Super-long/ChubbyGo / Pop

Method Pop

BaseServer/concurrentHashMap.go:167–175  ·  view source on GitHub ↗

Removes an element from the map and returns it

(key string)

Source from the content-addressed store, hash-verified

165
166// Removes an element from the map and returns it
167func (m ConcurrentHashMap) Pop(key string) (v interface{}, exists bool) {
168 // Try to get shard.
169 shard := m.GetShard(key)
170 shard.Lock()
171 v, exists = shard.items[key]
172 delete(shard.items, key)
173 shard.Unlock()
174 return v, exists
175}
176
177// Checks if map is empty.
178func (m ConcurrentHashMap) IsEmpty() bool {

Callers

nothing calls this directly

Calls 1

GetShardMethod · 0.95

Tested by

no test coverage detected