diff --git a/cache/redis/integration_test.go b/cache/redis/integration_test.go index c9be33f3a7..ad3646124f 100644 --- a/cache/redis/integration_test.go +++ b/cache/redis/integration_test.go @@ -8,6 +8,7 @@ import ( "testing" "time" + "github.com/redis/go-redis/v9" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -17,7 +18,7 @@ const ( ) func TestCache(t *testing.T) { - cache, err := New(Options{ + cache, err := New(&redis.Options{ Addr: dsn, Password: "", // no password set DB: 0, // use default DB diff --git a/cache/redis/redis.go b/cache/redis/redis.go index e67b1ae65c..5197e0e8cd 100644 --- a/cache/redis/redis.go +++ b/cache/redis/redis.go @@ -7,22 +7,23 @@ import ( "time" "github.com/beatlabs/patron/cache" - "github.com/beatlabs/patron/client/redis" + patronredis "github.com/beatlabs/patron/client/redis" + "github.com/redis/go-redis/v9" ) var _ cache.TTLCache = &Cache{} // Cache encapsulates a Redis-based caching mechanism. type Cache struct { - rdb redis.Client + rdb *redis.Client } -// Options exposes the struct from go-redis package. -type Options redis.Options - // New creates a cache returns a new Redis client that will be used as the cache store. -func New(opt Options) (*Cache, error) { - redisDB := redis.New(redis.Options(opt)) +func New(opt *redis.Options) (*Cache, error) { + redisDB, err := patronredis.New(opt) + if err != nil { + return nil, err + } return &Cache{rdb: redisDB}, nil }