123456789101112131415161718192021222324252627 |
- // Copyright 2019 getensh.com. All rights reserved.
- // Use of this source code is governed by getensh.com.
- package redis
- func (p *Redis) Publish(channel string, message interface{}) (res int64, err error) {
- // 安全检查
- if p == nil {
- return res, errRedis
- }
- if p.cluster {
- // 客户端安全检查
- if p.cclient == nil {
- return res, errRedisCClient
- }
- return p.cclient.Publish(channel, message).Result()
- }
- // 客户端安全检查
- if p.client == nil {
- return res, errRedisClient
- }
- return p.client.Publish(channel, message).Result()
- }
|