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

Method Get

ch04/sharding.go:73–79  ·  view source on GitHub ↗

Get retrieves and returns a value from the map. If the value doesn't exist, nil is returned.

(key K)

Source from the content-addressed store, hash-verified

71// Get retrieves and returns a value from the map. If the value doesn't exist,
72// nil is returned.
73func (m ShardedMap[K, V]) Get(key K) V {
74 shard := m.getShard(key)
75 shard.RLock()
76 defer shard.RUnlock()
77
78 return shard.items[key]
79}
80
81func (m ShardedMap[K, V]) Set(key K, value V) {
82 shard := m.getShard(key)

Callers

nothing calls this directly

Calls 1

getShardMethod · 0.95

Tested by

no test coverage detected