From 90b561c3dfd6d4f59947553dff911ac06affefca Mon Sep 17 00:00:00 2001 From: Ryo Date: Tue, 5 Aug 2025 20:20:41 +0800 Subject: [PATCH] fix: test case cache.nil is null (#584) --- backend/infra/impl/cache/redis/redis.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/infra/impl/cache/redis/redis.go b/backend/infra/impl/cache/redis/redis.go index 4e6de603..e7e57344 100644 --- a/backend/infra/impl/cache/redis/redis.go +++ b/backend/infra/impl/cache/redis/redis.go @@ -29,12 +29,13 @@ import ( func New() cache.Cmdable { addr := os.Getenv("REDIS_ADDR") password := os.Getenv("REDIS_PASSWORD") - cache.SetDefaultNilError(redis.Nil) return NewWithAddrAndPassword(addr, password) } func NewWithAddrAndPassword(addr, password string) cache.Cmdable { + cache.SetDefaultNilError(redis.Nil) + rdb := redis.NewClient(&redis.Options{ Addr: addr, // Redis地址 DB: 0, // 默认数据库