refactor: 新增base.Repo与base.App,重构repo与app层代码

This commit is contained in:
meilin.huang
2023-10-26 17:15:49 +08:00
parent 10f6b03fb5
commit a1303b52eb
115 changed files with 1867 additions and 1696 deletions

View File

@@ -1,7 +1,6 @@
package cache
import (
"mayfly-go/pkg/biz"
"mayfly-go/pkg/logx"
"mayfly-go/pkg/rediscli"
"strconv"
@@ -41,13 +40,12 @@ func GetInt(key string) int {
}
// 如果系统有设置redis信息则使用redis存否则存于本机内存。duration == -1则为永久缓存
func SetStr(key, value string, duration time.Duration) {
func SetStr(key, value string, duration time.Duration) error {
if !useRedisCache() {
checkCache()
tm.Add(key, value, duration)
return
return tm.Add(key, value, duration)
}
biz.ErrIsNilAppendErr(rediscli.Set(key, value, duration), "redis set err: %s")
return rediscli.Set(key, value, duration)
}
// 删除指定key