httpclient/cache/ICache.go

55 lines
1.3 KiB
Go
Raw Permalink Normal View History

2024-06-03 18:42:46 +08:00
// Package cache ...
//
// Description : cache ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2024-06-03 15:49
package cache
import "git.zhangdeman.cn/gateway/httpclient/define"
// ICache 缓存定义
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:49 2024/6/3
type ICache interface {
// Enable 是否启用缓存(总开关)
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:50 2024/6/3
Enable() bool
// CacheTime 缓存时长, 单位 : s , 默认 1800, 最小值 90, 设置失效时间, 会上下波动60s, 避免缓存集中失效
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:50 2024/6/3
CacheTime() int64
// IsAllow 针对当前请求数据和状态, 是否允许缓存
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:52 2024/6/3
IsAllow(reqCfg *define.Request, response *define.Response) bool
// GetKey 获取缓存key
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:51 2024/6/3
GetKey(reqCfg *define.Request) string
// GetValue 获取缓存值
//
// Author : zhangdeman001@ke.com<张德满>
//
// Date : 16:01 2024/6/3
GetValue(cacheKey string) string
// SetValue 设置缓存
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 16:46 2024/6/3
SetValue(cacheKey string, cacheValue string) error
}