summaryrefslogtreecommitdiff
path: root/plugins/redis
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/redis')
-rw-r--r--plugins/redis/clients.go84
-rw-r--r--plugins/redis/interface.go12
-rw-r--r--plugins/redis/kv/kv.go2
3 files changed, 2 insertions, 96 deletions
diff --git a/plugins/redis/clients.go b/plugins/redis/clients.go
deleted file mode 100644
index d0a184d2..00000000
--- a/plugins/redis/clients.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package redis
-
-import (
- "github.com/go-redis/redis/v8"
- "github.com/spiral/errors"
-)
-
-// RedisClient return a client based on the provided section key
-// key sample: kv.some-section.redis
-// kv.redis
-// redis (root)
-func (p *Plugin) RedisClient(key string) (redis.UniversalClient, error) {
- const op = errors.Op("redis_get_client")
-
- if !p.cfgPlugin.Has(key) {
- return nil, errors.E(op, errors.Errorf("no such section: %s", key))
- }
-
- cfg := &Config{}
-
- err := p.cfgPlugin.UnmarshalKey(key, cfg)
- if err != nil {
- return nil, errors.E(op, err)
- }
-
- cfg.InitDefaults()
-
- uc := redis.NewUniversalClient(&redis.UniversalOptions{
- Addrs: cfg.Addrs,
- DB: cfg.DB,
- Username: cfg.Username,
- Password: cfg.Password,
- SentinelPassword: cfg.SentinelPassword,
- MaxRetries: cfg.MaxRetries,
- MinRetryBackoff: cfg.MaxRetryBackoff,
- MaxRetryBackoff: cfg.MaxRetryBackoff,
- DialTimeout: cfg.DialTimeout,
- ReadTimeout: cfg.ReadTimeout,
- WriteTimeout: cfg.WriteTimeout,
- PoolSize: cfg.PoolSize,
- MinIdleConns: cfg.MinIdleConns,
- MaxConnAge: cfg.MaxConnAge,
- PoolTimeout: cfg.PoolTimeout,
- IdleTimeout: cfg.IdleTimeout,
- IdleCheckFrequency: cfg.IdleCheckFreq,
- ReadOnly: cfg.ReadOnly,
- RouteByLatency: cfg.RouteByLatency,
- RouteRandomly: cfg.RouteRandomly,
- MasterName: cfg.MasterName,
- })
-
- return uc, nil
-}
-
-func (p *Plugin) DefaultClient() redis.UniversalClient {
- cfg := &Config{}
- cfg.InitDefaults()
-
- uc := redis.NewUniversalClient(&redis.UniversalOptions{
- Addrs: cfg.Addrs,
- DB: cfg.DB,
- Username: cfg.Username,
- Password: cfg.Password,
- SentinelPassword: cfg.SentinelPassword,
- MaxRetries: cfg.MaxRetries,
- MinRetryBackoff: cfg.MaxRetryBackoff,
- MaxRetryBackoff: cfg.MaxRetryBackoff,
- DialTimeout: cfg.DialTimeout,
- ReadTimeout: cfg.ReadTimeout,
- WriteTimeout: cfg.WriteTimeout,
- PoolSize: cfg.PoolSize,
- MinIdleConns: cfg.MinIdleConns,
- MaxConnAge: cfg.MaxConnAge,
- PoolTimeout: cfg.PoolTimeout,
- IdleTimeout: cfg.IdleTimeout,
- IdleCheckFrequency: cfg.IdleCheckFreq,
- ReadOnly: cfg.ReadOnly,
- RouteByLatency: cfg.RouteByLatency,
- RouteRandomly: cfg.RouteRandomly,
- MasterName: cfg.MasterName,
- })
-
- return uc
-}
diff --git a/plugins/redis/interface.go b/plugins/redis/interface.go
deleted file mode 100644
index 189b0002..00000000
--- a/plugins/redis/interface.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package redis
-
-import "github.com/go-redis/redis/v8"
-
-// Redis in the redis KV plugin interface
-type Redis interface {
- // RedisClient provides universal redis client
- RedisClient(key string) (redis.UniversalClient, error)
-
- // DefaultClient provide default redis client based on redis defaults
- DefaultClient() redis.UniversalClient
-}
diff --git a/plugins/redis/kv/kv.go b/plugins/redis/kv/kv.go
index b41cb86c..3d062fbb 100644
--- a/plugins/redis/kv/kv.go
+++ b/plugins/redis/kv/kv.go
@@ -248,3 +248,5 @@ func (d *Driver) Clear() error {
return nil
}
+
+func (d *Driver) Stop() {}