|
@@ -116,6 +116,14 @@ func NewRedisClusterCache() *RedisCache {
|
|
|
return &RedisCache{cc: client}
|
|
|
}
|
|
|
|
|
|
+// Get get value from cache
|
|
|
+func (c RedisCache) Ping() (string, error) {
|
|
|
+ if c.cc != nil {
|
|
|
+ return c.cc.Ping().Result()
|
|
|
+ }
|
|
|
+ return c.c.Ping().Result()
|
|
|
+}
|
|
|
+
|
|
|
// Get get value from cache
|
|
|
func (c RedisCache) Get(key string) (string, error) {
|
|
|
if c.cc != nil {
|
|
@@ -201,6 +209,26 @@ func connect() (*RedisCache, error) {
|
|
|
return cache, err
|
|
|
}
|
|
|
|
|
|
+// Ping ping
|
|
|
+func Ping() (string, error) {
|
|
|
+ c, err := connect()
|
|
|
+ if err != nil {
|
|
|
+ return "", err
|
|
|
+ }
|
|
|
+
|
|
|
+ return c.Ping()
|
|
|
+}
|
|
|
+
|
|
|
+// Info info
|
|
|
+func Info() (string, error) {
|
|
|
+ c, err := connect()
|
|
|
+ if err != nil {
|
|
|
+ return "", err
|
|
|
+ }
|
|
|
+
|
|
|
+ return c.Info()
|
|
|
+}
|
|
|
+
|
|
|
// Get key from cache
|
|
|
func Get(key string) (string, error) {
|
|
|
c, err := connect()
|
|
@@ -228,15 +256,6 @@ 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()
|
|
|
-}
|
|
|
-
|
|
|
// Publish publish message
|
|
|
func Publish(channel, message string) error {
|
|
|
c, err := connect()
|