Documentation
¶
Overview ¶
Package cache 提供了基于内存的HTTP响应缓存中间件
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func URLAndHeaderKeyGenerator ¶
URLAndHeaderKeyGenerator 返回一个基于URL和指定头的键生成器函数
func URLKeyGenerator ¶
URLKeyGenerator 返回一个基于请求URL的键生成器函数
Types ¶
type ResponseCache ¶
type ResponseCache struct {
// contains filtered or unexported fields
}
ResponseCache 用于缓存HTTP响应数据
func New ¶
func New(size int, ttl time.Duration) (*ResponseCache, error)
New 创建一个新的ResponseCache实例 size: 缓存项数量 ttl: 缓存项过期时间
func (*ResponseCache) Middleware ¶
func (rc *ResponseCache) Middleware(keyFunc func(*mist.Context) string) mist.Middleware
Middleware 创建一个缓存中间件,使用给定的键生成器函数 keyFunc 函数用于从请求上下文生成缓存键
Click to show internal directories.
Click to hide internal directories.