Fix: failed unit test / Feat: support TTL in redis cache
This commit is contained in:
@@ -31,7 +31,7 @@ func GetSettingByName(name string) string {
|
||||
// 尝试数据库中查找
|
||||
result := DB.Where("name = ?", name).First(&setting)
|
||||
if result.Error == nil {
|
||||
_ = cache.Set(cacheKey, setting.Value)
|
||||
_ = cache.Set(cacheKey, setting.Value, -1)
|
||||
return setting.Value
|
||||
}
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user