Documentation ¶
Index ¶
- func CanHandle(r *http.Request, re types.RetrieverResponsePropertiesInterface) bool
- func DefaultSouinPluginCallback(res http.ResponseWriter, req *http.Request, ...) (e error)
- func DefaultSouinPluginInitializerFromConfiguration(c configurationtypes.AbstractConfigurationInterface) *types.RetrieverResponseProperties
- func HasMutation(req *http.Request, rw http.ResponseWriter) bool
- type BaseConfiguration
- func (c *BaseConfiguration) GetAPI() configurationtypes.API
- func (c *BaseConfiguration) GetCacheKeys() map[configurationtypes.RegValue]configurationtypes.Key
- func (c *BaseConfiguration) GetDefaultCache() configurationtypes.DefaultCacheInterface
- func (c *BaseConfiguration) GetLogLevel() string
- func (c *BaseConfiguration) GetLogger() *zap.Logger
- func (c *BaseConfiguration) GetSurrogateKeys() map[string]configurationtypes.SurrogateKeys
- func (c *BaseConfiguration) GetUrls() map[string]configurationtypes.URL
- func (c *BaseConfiguration) GetYkeys() map[string]configurationtypes.SurrogateKeys
- func (c *BaseConfiguration) SetLogger(l *zap.Logger)
- type CustomWriter
- type SouinBasePlugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanHandle ¶
func CanHandle(r *http.Request, re types.RetrieverResponsePropertiesInterface) bool
CanHandle detect if the request can be handled by Souin
func DefaultSouinPluginCallback ¶
func DefaultSouinPluginCallback( res http.ResponseWriter, req *http.Request, retriever types.RetrieverResponsePropertiesInterface, rc coalescing.RequestCoalescingInterface, nextMiddleware func(w http.ResponseWriter, r *http.Request) error, ) (e error)
DefaultSouinPluginCallback is the default callback for plugins
func DefaultSouinPluginInitializerFromConfiguration ¶
func DefaultSouinPluginInitializerFromConfiguration(c configurationtypes.AbstractConfigurationInterface) *types.RetrieverResponseProperties
DefaultSouinPluginInitializerFromConfiguration is the default initialization for plugins
func HasMutation ¶
func HasMutation(req *http.Request, rw http.ResponseWriter) bool
Types ¶
type BaseConfiguration ¶ added in v1.6.10
type BaseConfiguration struct { DefaultCache *configurationtypes.DefaultCache `json:"default_cache" yaml:"default_cache"` API configurationtypes.API `json:"api" yaml:"api"` CacheKeys map[configurationtypes.RegValue]configurationtypes.Key `yaml:"cache_keys"` URLs map[string]configurationtypes.URL `json:"urls" yaml:"urls"` LogLevel string `json:"log_level" yaml:"log_level"` Logger *zap.Logger Ykeys map[string]configurationtypes.SurrogateKeys `json:"ykeys" yaml:"ykeys"` SurrogateKeys map[string]configurationtypes.SurrogateKeys `json:"surrogate_keys" yaml:"surrogate_keys"` }
BaseConfiguration holder
func (*BaseConfiguration) GetAPI ¶ added in v1.6.10
func (c *BaseConfiguration) GetAPI() configurationtypes.API
GetAPI get the default cache
func (*BaseConfiguration) GetCacheKeys ¶ added in v1.6.10
func (c *BaseConfiguration) GetCacheKeys() map[configurationtypes.RegValue]configurationtypes.Key
GetCacheKeys get the cache keys rules to override
func (*BaseConfiguration) GetDefaultCache ¶ added in v1.6.10
func (c *BaseConfiguration) GetDefaultCache() configurationtypes.DefaultCacheInterface
GetDefaultCache get the default cache
func (*BaseConfiguration) GetLogLevel ¶ added in v1.6.10
func (c *BaseConfiguration) GetLogLevel() string
GetLogLevel get the log level
func (*BaseConfiguration) GetLogger ¶ added in v1.6.10
func (c *BaseConfiguration) GetLogger() *zap.Logger
GetLogger get the logger
func (*BaseConfiguration) GetSurrogateKeys ¶ added in v1.6.10
func (c *BaseConfiguration) GetSurrogateKeys() map[string]configurationtypes.SurrogateKeys
GetSurrogateKeys get the surrogate keys list
func (*BaseConfiguration) GetUrls ¶ added in v1.6.10
func (c *BaseConfiguration) GetUrls() map[string]configurationtypes.URL
GetUrls get the urls list in the configuration
func (*BaseConfiguration) GetYkeys ¶ added in v1.6.10
func (c *BaseConfiguration) GetYkeys() map[string]configurationtypes.SurrogateKeys
GetYkeys get the ykeys list
func (*BaseConfiguration) SetLogger ¶ added in v1.6.10
func (c *BaseConfiguration) SetLogger(l *zap.Logger)
SetLogger set the logger
type CustomWriter ¶
type CustomWriter struct { Response *http.Response Buf *bytes.Buffer Rw http.ResponseWriter Req *http.Request // contains filtered or unexported fields }
CustomWriter handles the response and provide the way to cache the value
func (*CustomWriter) Header ¶
func (r *CustomWriter) Header() http.Header
Header will write the response headers
func (*CustomWriter) Send ¶
func (r *CustomWriter) Send() (int, error)
Send delays the response to handle Cache-Status
func (*CustomWriter) Write ¶
func (r *CustomWriter) Write(b []byte) (int, error)
Write will write the response body
func (*CustomWriter) WriteHeader ¶
func (r *CustomWriter) WriteHeader(code int)
WriteHeader will write the response headers
type SouinBasePlugin ¶
type SouinBasePlugin struct { Retriever types.RetrieverResponsePropertiesInterface RequestCoalescing coalescing.RequestCoalescingInterface MapHandler *api.MapHandler }
SouinBasePlugin declaration.
func (*SouinBasePlugin) HandleInternally ¶
func (s *SouinBasePlugin) HandleInternally(r *http.Request) (bool, http.HandlerFunc)
HandleInternally handles the Souin custom endpoints