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

Method cmdsInfo

ring.go:758–775  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

756}
757
758func (c *Ring) cmdsInfo(ctx context.Context) (map[string]*CommandInfo, error) {
759 // note: `c.List()` return a shadow copy of `[]*ringShard`.
760 shards := c.sharding.List()
761 var firstErr error
762 for _, shard := range shards {
763 cmdsInfo, err := shard.Client.Command(ctx).Result()
764 if err == nil {
765 return cmdsInfo, nil
766 }
767 if firstErr == nil {
768 firstErr = err
769 }
770 }
771 if firstErr == nil {
772 return nil, errRingShardsDown
773 }
774 return nil, firstErr
775}
776
777func (c *Ring) cmdShard(cmd Cmder) (*ringShard, error) {
778 // TODO: populate cmdsInfoCache lazily (via cmdsInfoCache.Get) so that

Callers

nothing calls this directly

Calls 3

ListMethod · 0.80
ResultMethod · 0.65
CommandMethod · 0.65

Tested by

no test coverage detected