This commit is contained in:
xxj
2021-02-08 17:46:26 +08:00
parent 421d43d795
commit 30def31db3
3 changed files with 15 additions and 4 deletions

View File

@@ -68,7 +68,7 @@ func GetSuccessMsg(codes ...ErrCode) (msg MessageBody) {
// GetError 获取错误信息
func GetError(code ErrCode) error {
_tryRegisteryCode(code)
go _tryRegisteryCode(code)
return fmt.Errorf(code.String())
}

View File

@@ -10,6 +10,18 @@ import (
"github.com/xxjwxc/public/serializing"
)
// CacheIFS 缓存操作接口
type CacheIFS interface {
Destory() // 析构
Add(key interface{}, value interface{}, lifeSpan time.Duration) error // 添加一个元素
Value(key interface{}, value interface{}) error // 获取一个value
IsExist(key interface{}) bool // 判断是否存在
Delete(key interface{}) error // 删除一个
Clear() error // 清空
Close() (err error) // 关闭连接
}
// MyCache 内存缓存
type MyCache struct {
cache *cache2go.CacheTable

View File

@@ -8,7 +8,6 @@ import (
"time"
"github.com/gomodule/redigo/redis"
"github.com/prometheus/common/log"
"github.com/xxjwxc/public/dev"
"github.com/xxjwxc/public/mylog"
"github.com/xxjwxc/public/tools"
@@ -188,7 +187,7 @@ func (mc *base) Do(con redis.Conn, commandName string, args ...interface{}) (rep
for _, v := range args {
cmd += fmt.Sprintf(" %v", v)
}
log.Infof("redis req :%v", cmd)
mylog.Infof("redis req :%v", cmd)
}
if con != nil {
@@ -204,7 +203,7 @@ func (mc *base) Do(con redis.Conn, commandName string, args ...interface{}) (rep
case int64:
tmp = fmt.Sprintf("%v", reply)
}
log.Infof("redis resp:%v,%v", tmp, err)
mylog.Infof("redis resp:%v,%v", tmp, err)
}
return
}