MCPcopy
hub / github.com/redis/go-redis / GetShardClientForKey

Method GetShardClientForKey

ring.go:951–957  ·  view source on GitHub ↗

GetShardClientForKey returns the shard client that would handle the given key. This can be used to determine which shard a particular key/channel would be routed to.

(key string)

Source from the content-addressed store, hash-verified

949// GetShardClientForKey returns the shard client that would handle the given key.
950// This can be used to determine which shard a particular key/channel would be routed to.
951func (c *Ring) GetShardClientForKey(key string) (*Client, error) {
952 shard, err := c.sharding.GetByKey(key)
953 if err != nil {
954 return nil, err
955 }
956 return shard.Client, nil
957}

Callers 1

ring_test.goFile · 0.80

Calls 1

GetByKeyMethod · 0.80

Tested by

no test coverage detected