plugins

package
v1.6.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanHandle

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

GetAPI get the default cache

func (*BaseConfiguration) GetCacheKeys added in v1.6.10

GetCacheKeys get the cache keys rules to override

func (*BaseConfiguration) GetDefaultCache added in v1.6.10

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

GetUrls get the urls list in the configuration

func (*BaseConfiguration) GetYkeys added in v1.6.10

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
}

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

Directories

Path Synopsis
beego module
caddy module
chi module
dotweb module
echo module
fiber module
gin module
go-zero module
goa module
goyave module
hertz module
kratos module
roadrunner module
skipper module
storages Module
traefik module
tyk module
webgo module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL