MCPcopy Create free account
hub / github.com/cloud-native-go/examples / Delete

Method Delete

ch04/sharding.go:63–69  ·  view source on GitHub ↗

Delete removes a value from the map. If key doesn't exist in the map, this method is a no-op.

(key K)

Source from the content-addressed store, hash-verified

61// Delete removes a value from the map. If key doesn't exist in the map,
62// this method is a no-op.
63func (m ShardedMap[K, V]) Delete(key K) {
64 shard := m.getShard(key)
65 shard.Lock()
66 defer shard.Unlock()
67
68 delete(shard.items, key)
69}
70
71// Get retrieves and returns a value from the map. If the value doesn't exist,
72// nil is returned.

Callers

nothing calls this directly

Calls 1

getShardMethod · 0.95

Tested by

no test coverage detected