upgrade: update wrapper

This commit is contained in:
2025-10-13 22:51:55 +08:00
parent a4abdd7038
commit 0c0d237bd6
3 changed files with 35 additions and 11 deletions

View File

@ -9,9 +9,10 @@ package cache
import (
"context"
cacheAbstract "git.zhangdeman.cn/zhangdeman/cache/abstract"
"git.zhangdeman.cn/zhangdeman/redis"
"git.zhangdeman.cn/zhangdeman/wrapper"
"git.zhangdeman.cn/zhangdeman/wrapper/op_string"
)
var (
@ -49,7 +50,11 @@ func (r *Redis) TTL(ctx context.Context, instanceFlag string, key string) (int64
ctx = context.Background()
}
res := redis.Wrapper.TTL(ctx, instanceFlag, key)
return wrapper.String(res.Result).ToInt64().Value, res.Err
if nil != res.Err {
return 0, res.Err
}
ttlRes := op_string.ToBaseTypeValue[int64](res.Result)
return ttlRes.Value, ttlRes.Err
}
// Set 设置缓存