缓存支持读取缓存key的剩余有效时间

This commit is contained in:
2024-10-09 18:30:12 +08:00
parent 225a1ae9b2
commit 9088f515d3
5 changed files with 52 additions and 6 deletions

View File

@ -26,6 +26,8 @@ type ResultParseFunc func(res string) error
type ICache interface {
// Exist 缓存是否存在
Exist(ctx context.Context, cacheInstanceFlag string, key string) (bool, error)
// TTL key还有多长时间过期
TTL(ctx context.Context, cacheInstanceFlag string, key string) (int64, error)
// Set 设置缓存
Set(ctx context.Context, cacheInstanceFlag string, key string, value string, ttl int64) error
// Get 读取原始缓存数据