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

Method Get

command.go:5216–5237  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

5214}
5215
5216func (c *cmdsInfoCache) Get(ctx context.Context) (map[string]*CommandInfo, error) {
5217 c.refreshLock.Lock()
5218 defer c.refreshLock.Unlock()
5219
5220 err := c.once.Do(func() error {
5221 cmds, err := c.fn(ctx)
5222 if err != nil {
5223 return err
5224 }
5225
5226 lowerCmds := make(map[string]*CommandInfo, len(cmds))
5227
5228 // Extensions have cmd names in upper case. Convert them to lower case.
5229 for k, v := range cmds {
5230 lowerCmds[internal.ToLower(k)] = v
5231 }
5232
5233 c.cmds = lowerCmds
5234 return nil
5235 })
5236 return c.cmds, err
5237}
5238
5239func (c *cmdsInfoCache) Refresh() {
5240 c.refreshLock.Lock()

Callers

nothing calls this directly

Calls 2

ToLowerFunction · 0.92
DoMethod · 0.65

Tested by

no test coverage detected