mirror of
https://github.com/xxjwxc/public.git
synced 2025-09-26 20:01:19 +08:00
new
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user