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

Method PUnsubscribe

pubsub.go:298–313  ·  view source on GitHub ↗

PUnsubscribe the client from the given patterns, or from all of them if none is given.

(ctx context.Context, patterns ...string)

Source from the content-addressed store, hash-verified

296// PUnsubscribe the client from the given patterns, or from all of
297// them if none is given.
298func (c *PubSub) PUnsubscribe(ctx context.Context, patterns ...string) error {
299 c.mu.Lock()
300 defer c.mu.Unlock()
301
302 if len(patterns) > 0 {
303 for _, pattern := range patterns {
304 delete(c.patterns, pattern)
305 }
306 } else {
307 // Unsubscribe from all patterns.
308 clear(c.patterns)
309 }
310
311 err := c.subscribe(ctx, "punsubscribe", patterns...)
312 return err
313}
314
315// SUnsubscribe unsubscribes the client from the given shard channels,
316// or from all of them if none is given.

Callers 1

pubsub_test.goFile · 0.80

Calls 1

subscribeMethod · 0.95

Tested by

no test coverage detected