1234567891011121314151617181920212223242526272829 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package redis
- import "time"
- func (p *Redis) Time() (res time.Time, err error) {
- // 安全检查
- if p == nil {
- return res, errRedis
- }
- if p.cluster {
- // 客户端安全检查
- if p.cclient == nil {
- return res, errRedisCClient
- }
- return p.cclient.Time().Result()
- }
- // 客户端安全检查
- if p.client == nil {
- return res, errRedisClient
- }
- return p.client.Time().Result()
- }
|