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

Method ClientSetName

pubsub.go:368–382  ·  view source on GitHub ↗

ClientSetName assigns a namee to the PubSub connection using CLIENT SETNAME, The name is visible in CLIENT LIST output and is useful for debugging and identifying connections in a redis instance.

(ctx context.Context, name string)

Source from the content-addressed store, hash-verified

366// The name is visible in CLIENT LIST output and is useful for debugging
367// and identifying connections in a redis instance.
368func (c *PubSub) ClientSetName(ctx context.Context, name string) error {
369 cmd := NewStatusCmd(ctx, "client", "setname", name)
370
371 c.mu.Lock()
372 defer c.mu.Unlock()
373
374 cn, err := c.conn(ctx, nil)
375 if err != nil {
376 return err
377 }
378
379 err = c.writeCmd(ctx, cn, cmd)
380 c.releaseConn(ctx, cn, err, false)
381 return err
382}
383
384// Subscription received after a successful subscription to channel.
385type Subscription struct {

Callers

nothing calls this directly

Calls 4

connMethod · 0.95
writeCmdMethod · 0.95
releaseConnMethod · 0.95
NewStatusCmdFunction · 0.85

Tested by

no test coverage detected