mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 08:20:25 +08:00
fix: 缓存使用redis无法set问题修复&admin账号默认有所有菜单
This commit is contained in:
10
server/pkg/cache/str_cache.go
vendored
10
server/pkg/cache/str_cache.go
vendored
@@ -1,6 +1,7 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"mayfly-go/pkg/biz"
|
||||
"mayfly-go/pkg/logx"
|
||||
"mayfly-go/pkg/rediscli"
|
||||
"strconv"
|
||||
@@ -20,11 +21,10 @@ func GetStr(key string) string {
|
||||
return val.(string)
|
||||
}
|
||||
|
||||
res, err := rediscli.Get(key)
|
||||
if err != nil {
|
||||
return ""
|
||||
if res, err := rediscli.Get(key); err == nil {
|
||||
return res
|
||||
}
|
||||
return res
|
||||
return ""
|
||||
}
|
||||
|
||||
func GetInt(key string) int {
|
||||
@@ -47,7 +47,7 @@ func SetStr(key, value string, duration time.Duration) {
|
||||
tm.Add(key, value, duration)
|
||||
return
|
||||
}
|
||||
rediscli.Set(key, value, duration)
|
||||
biz.ErrIsNilAppendErr(rediscli.Set(key, value, duration), "redis set err: %s")
|
||||
}
|
||||
|
||||
// 删除指定key
|
||||
|
||||
Reference in New Issue
Block a user