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

Method Pop

zutils/shard_lock_map.go:169–176  ·  view source on GitHub ↗

Pop removes an element from the map and returns it

(key string)

Source from the content-addressed store, hash-verified

167
168// Pop removes an element from the map and returns it
169func (slm ShardLockMaps) Pop(key string) (v interface{}, exists bool) {
170 shard := slm.GetShard(key)
171 shard.Lock()
172 v, exists = shard.items[key]
173 delete(shard.items, key)
174 shard.Unlock()
175 return v, exists
176}
177
178// GetOrSet gets the value for the given key, or sets it if it doesn't exist.
179// Returns the value and whether it was set (true) or already existed (false).

Callers 1

TestPopFunction · 0.95

Calls 1

GetShardMethod · 0.95

Tested by 1

TestPopFunction · 0.76