fix: test case cache.nil is null (#584)

This commit is contained in:
Ryo 2025-08-05 20:20:41 +08:00 committed by GitHub
parent 8848ad3ff4
commit 90b561c3df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -29,12 +29,13 @@ import (
func New() cache.Cmdable { func New() cache.Cmdable {
addr := os.Getenv("REDIS_ADDR") addr := os.Getenv("REDIS_ADDR")
password := os.Getenv("REDIS_PASSWORD") password := os.Getenv("REDIS_PASSWORD")
cache.SetDefaultNilError(redis.Nil)
return NewWithAddrAndPassword(addr, password) return NewWithAddrAndPassword(addr, password)
} }
func NewWithAddrAndPassword(addr, password string) cache.Cmdable { func NewWithAddrAndPassword(addr, password string) cache.Cmdable {
cache.SetDefaultNilError(redis.Nil)
rdb := redis.NewClient(&redis.Options{ rdb := redis.NewClient(&redis.Options{
Addr: addr, // Redis地址 Addr: addr, // Redis地址
DB: 0, // 默认数据库 DB: 0, // 默认数据库