修复构建redis结果读取的异常 + 增加exist方法
This commit is contained in:
parent
27e193a0ea
commit
9daae92046
17
client.go
17
client.go
@ -74,13 +74,14 @@ func (o *OwnClient) Exec(ctx context.Context, instanceFlag string, command strin
|
|||||||
cmdParamList = append(cmdParamList, itemArg)
|
cmdParamList = append(cmdParamList, itemArg)
|
||||||
}
|
}
|
||||||
res := &define.RedisResult{
|
res := &define.RedisResult{
|
||||||
StartTime: time.Now().UnixMilli(),
|
StartTime: time.Now().UnixMilli(),
|
||||||
FinishTime: 0,
|
FinishTime: 0,
|
||||||
UsedTime: 0,
|
UsedTime: 0,
|
||||||
Result: "",
|
Result: "",
|
||||||
Command: command,
|
Command: command,
|
||||||
ArgList: argStrList,
|
ArgList: argStrList,
|
||||||
Err: nil,
|
Err: nil,
|
||||||
|
InstanceFlag: instanceFlag,
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
res.FinishTime = time.Now().UnixMilli()
|
res.FinishTime = time.Now().UnixMilli()
|
||||||
@ -110,7 +111,7 @@ func (o *OwnClient) Exec(ctx context.Context, instanceFlag string, command strin
|
|||||||
if res.Err = cmdRes.Err(); nil != res.Err {
|
if res.Err = cmdRes.Err(); nil != res.Err {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
res.Result = cmdRes.String()
|
res.Result = wrapperOperate.AnyDataType(cmdRes.Val()).ToString().Value()
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,15 @@ var (
|
|||||||
type wrapper struct {
|
type wrapper struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Exist 缓存Key是否存在
|
||||||
|
//
|
||||||
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
|
//
|
||||||
|
// Date : 12:31 2024/6/21
|
||||||
|
func (w *wrapper) Exist(ctx context.Context, instanceFlag string, key string) *define.RedisResult {
|
||||||
|
return Client.Exec(ctx, instanceFlag, "EXISTS", key)
|
||||||
|
}
|
||||||
|
|
||||||
// Get Get命令
|
// Get Get命令
|
||||||
//
|
//
|
||||||
// Author : go_developer@163.com<白茶清欢>
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
|
Loading…
Reference in New Issue
Block a user