Documentation
¶
Index ¶
Constants ¶
const StickyEntry = "c_sticky"
StickyEntry is the name of the context key to be set when we want an entry to be sticky `sticky` entries are not purged when the cache is full. Only when we forcefully evict them
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheFlusher ¶
CacheFlusher defines the interface to be used by components that need to evict/flush entries from the cache
type KeyFactoryFn ¶
KeyFactoryFn defines the function signature for a Key Factory
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware struct implements a gin middleware that offers request-caching
func New ¶
func New(options *Options) *Middleware
New creates a new middleware with a custom key factory function
func (*Middleware) EvictBySurrogate ¶
func (h *Middleware) EvictBySurrogate(key string)
EvictBySurrogate keys referenced by a surrogate
func (*Middleware) Handle ¶
func (h *Middleware) Handle(ctx *gin.Context)
Handle is the function that should be passed to your router's `.Use()` method
type Options ¶
type Options struct { Size int KeyFactory KeyFactoryFn SurrogateFactory SurrogateFactoryFn SuccessfulOnly bool }
Options wraps all parameters used to configure the caching middleware
type SurrogateFactoryFn ¶
SurrogateFactoryFn defines the function signature for a Surrogate key list factory