调整xorm层级

This commit is contained in:
2023-01-18 16:00:50 +08:00
parent 0f8c1f989b
commit a89c86023e
67 changed files with 500 additions and 460 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
package cache
import (
"cutego/modules/core/dao"
"cutego/modules"
"cutego/pkg/common"
"cutego/pkg/constant"
)
@@ -9,14 +9,14 @@ import (
// RemoveList 批量根据Key删除数据
// @Param list []string 键合集
func RemoveList(list []string) {
dao.RedisDB.DELALL(list)
modules.RedisDB.DELALL(list)
}
// RemoveKey 根据key删除
// @Param key 键
// @Return int 删除的数量
func RemoveCache(key string) int {
del, err := dao.RedisDB.DEL(key)
del, err := modules.RedisDB.DEL(key)
if err != nil {
common.ErrorLog(err)
}
@@ -27,7 +27,7 @@ func RemoveCache(key string) int {
// @Param key 键
// @Return string 值
func GetCache(key string) string {
val, err := dao.RedisDB.GET(key)
val, err := modules.RedisDB.GET(key)
if err != nil {
common.ErrorLog(constant.RedisConst{}.GetRedisError(), err.Error())
return ""
@@ -40,7 +40,7 @@ func GetCache(key string) string {
// @Param value 值
// @Return 新增的行数
func SetCache(key string, value interface{}) int {
n, err := dao.RedisDB.SET(key, common.StructToJson(value))
n, err := modules.RedisDB.SET(key, common.StructToJson(value))
if err != nil {
common.ErrorLog(constant.RedisConst{}.GetRedisError(), err.Error())
return 0
@@ -54,5 +54,5 @@ func SetCache(key string, value interface{}) int {
// @Param sec 过期时间(单位: 秒)
// @Return 新增的行数
func SetCacheTTL(key string, value interface{}, sec int) {
dao.RedisDB.SETEX(key, sec, common.StructToJson(value))
modules.RedisDB.SETEX(key, sec, common.StructToJson(value))
}