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

Method GetShardClients

ring.go:938–947  ·  view source on GitHub ↗

GetShardClients returns a list of all shard clients in the ring. This can be used to create dedicated connections (e.g., PubSub) for each shard.

()

Source from the content-addressed store, hash-verified

936// GetShardClients returns a list of all shard clients in the ring.
937// This can be used to create dedicated connections (e.g., PubSub) for each shard.
938func (c *Ring) GetShardClients() []*Client {
939 shards := c.sharding.List()
940 clients := make([]*Client, 0, len(shards))
941 for _, shard := range shards {
942 if shard.IsUp() {
943 clients = append(clients, shard.Client)
944 }
945 }
946 return clients
947}
948
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.

Callers 1

ring_test.goFile · 0.80

Calls 2

ListMethod · 0.80
IsUpMethod · 0.80

Tested by

no test coverage detected