diff --git a/client.go b/client.go index 23aa536..23adad2 100644 --- a/client.go +++ b/client.go @@ -74,13 +74,14 @@ func (o *OwnClient) Exec(ctx context.Context, instanceFlag string, command strin cmdParamList = append(cmdParamList, itemArg) } res := &define.RedisResult{ - StartTime: time.Now().UnixMilli(), - FinishTime: 0, - UsedTime: 0, - Result: "", - Command: command, - ArgList: argStrList, - Err: nil, + StartTime: time.Now().UnixMilli(), + FinishTime: 0, + UsedTime: 0, + Result: "", + Command: command, + ArgList: argStrList, + Err: nil, + InstanceFlag: instanceFlag, } defer func() { 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 { return res } - res.Result = cmdRes.String() + res.Result = wrapperOperate.AnyDataType(cmdRes.Val()).ToString().Value() return res } diff --git a/wrapper.go b/wrapper.go index e3792ef..ac6509e 100644 --- a/wrapper.go +++ b/wrapper.go @@ -26,6 +26,15 @@ var ( 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命令 // // Author : go_developer@163.com<白茶清欢>