|
@@ -11,6 +11,7 @@ import (
|
|
|
type RedisConfig struct {
|
|
|
Addr string
|
|
|
Password string
|
|
|
+ DB int
|
|
|
DialTimeout time.Duration
|
|
|
ReadTimeout time.Duration
|
|
|
WriteTimeout time.Duration
|
|
@@ -23,6 +24,9 @@ type RedisClusterConfig struct {
|
|
|
// A seed list of host:port addresses of cluster nodes.
|
|
|
Addrs []string
|
|
|
|
|
|
+ Password string
|
|
|
+ DB int
|
|
|
+
|
|
|
// The maximum number of retries before giving up. Command is retried
|
|
|
// on network errors and MOVED/ASK redirects.
|
|
|
// Default is 16.
|
|
@@ -38,7 +42,6 @@ type RedisClusterConfig struct {
|
|
|
MaxRetries int
|
|
|
MinRetryBackoff time.Duration
|
|
|
MaxRetryBackoff time.Duration
|
|
|
- Password string
|
|
|
|
|
|
DialTimeout time.Duration
|
|
|
ReadTimeout time.Duration
|
|
@@ -137,6 +140,14 @@ func (c RedisCache) Del(key string) (int64, error) {
|
|
|
return c.c.Del(key).Result()
|
|
|
}
|
|
|
|
|
|
+// Info info
|
|
|
+func (c RedisCache) Info() (string, error) {
|
|
|
+ if c.cc != nil {
|
|
|
+ return c.cc.Info().Result()
|
|
|
+ }
|
|
|
+ return c.c.Info().Result()
|
|
|
+}
|
|
|
+
|
|
|
// Subscribe subscribe message
|
|
|
func (c RedisCache) Subscribe(channels string, cb func(channel string, message string, err error)) {
|
|
|
pubsub := &redis.PubSub{}
|
|
@@ -219,3 +230,12 @@ func Del(key string) (int64, error) {
|
|
|
}
|
|
|
return c.Del(key)
|
|
|
}
|
|
|
+
|
|
|
+func Info() (string, error) {
|
|
|
+ c, err := connect()
|
|
|
+ if err != nil {
|
|
|
+ return "", err
|
|
|
+ }
|
|
|
+
|
|
|
+ return c.Info()
|
|
|
+}
|