| 1234567891011121314151617 |
- package redisx
- import (
- "context"
- "github.com/redis/go-redis/v9"
- )
- // 发布订阅
- func Publish(ctx context.Context, channel string, msg interface{}) error {
- return getClient().Publish(ctx, channel, msg).Err()
- }
- func Subscribe(ctx context.Context, channel string) *redis.PubSub {
- return getClient().Subscribe(ctx, channel)
- }
|