Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cache ¶
func Cache(keyGenerator KeyGenerator, options Options) gin.HandlerFunc
Cache user must pass getCacheKey to describe the way to generate cache key
func CacheByPath ¶
func CacheByPath(options Options) gin.HandlerFunc
CacheByPath a shortcut function for caching response with url path, discard the query params
func CacheByURI ¶
func CacheByURI(options Options) gin.HandlerFunc
CacheByURI a shortcut function for caching response with uri
Types ¶
type Options ¶
type Options struct {
// CacheStore the cache backend to store response
CacheStore persist.CacheStore
// CacheDuration
CacheDuration time.Duration
// DisableSingleFlight means whether use singleflight to avoid Hotspot Invalid when cache miss
DisableSingleFlight bool
// SingleflightForgetTime this option only be effective when DisableSingleFlight is false
SingleflightForgetTime time.Duration
// Logger
Logger *logrus.Logger
}
Click to show internal directories.
Click to hide internal directories.

