v1.6.49 Latest Latest

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 29 Imported by: 23




This section is empty.


View Source
var Upstream50xError = upstream50xError{}


This section is empty.


type BaseConfiguration

type BaseConfiguration struct {
	DefaultCache  *configurationtypes.DefaultCache  `json:"default_cache" yaml:"default_cache"`
	API           configurationtypes.API            `json:"api" yaml:"api"`
	CacheKeys     configurationtypes.CacheKeys      `json:"cache_keys" yaml:"cache_keys"`
	URLs          map[string]configurationtypes.URL `json:"urls" yaml:"urls"`
	LogLevel      string                            `json:"log_level" yaml:"log_level"`
	Logger        *zap.Logger
	PluginName    string
	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

GetAPI get the default cache

func (*BaseConfiguration) GetCacheKeys

GetCacheKeys get the cache keys rules to override

func (*BaseConfiguration) GetDefaultCache

GetDefaultCache get the default cache

func (*BaseConfiguration) GetLogLevel

func (c *BaseConfiguration) GetLogLevel() string

GetLogLevel get the log level

func (*BaseConfiguration) GetLogger

func (c *BaseConfiguration) GetLogger() *zap.Logger

GetLogger get the logger

func (*BaseConfiguration) GetPluginName added in v1.6.48

func (c *BaseConfiguration) GetPluginName() string

GetPluginName get the plugin name

func (*BaseConfiguration) GetSurrogateKeys

func (c *BaseConfiguration) GetSurrogateKeys() map[string]configurationtypes.SurrogateKeys

GetSurrogateKeys get the surrogate keys list

func (*BaseConfiguration) GetUrls

GetUrls get the urls list in the configuration

func (*BaseConfiguration) GetYkeys

GetYkeys get the ykeys list

func (*BaseConfiguration) SetLogger

func (c *BaseConfiguration) SetLogger(l *zap.Logger)

SetLogger set the logger

type CustomWriter

type CustomWriter struct {
	Buf     *bytes.Buffer
	Rw      http.ResponseWriter
	Req     *http.Request
	Headers http.Header
	// contains filtered or unexported fields

CustomWriter handles the response and provide the way to cache the value

func NewCustomWriter

func NewCustomWriter(rq *http.Request, rw http.ResponseWriter, b *bytes.Buffer) *CustomWriter

func (*CustomWriter) GetStatusCode added in v1.6.45

func (r *CustomWriter) GetStatusCode() int

GetStatusCode returns the response status code

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 SouinBaseHandler

type SouinBaseHandler struct {
	Configuration            configurationtypes.AbstractConfigurationInterface
	Storers                  []types.Storer
	InternalEndpointHandlers *api.MapHandler
	ExcludeRegex             *regexp.Regexp
	RegexpUrls               regexp.Regexp
	SurrogateKeys            configurationtypes.SurrogateKeys
	SurrogateKeyStorer       providers.SurrogateInterface
	DefaultMatchedUrl        configurationtypes.URL
	// contains filtered or unexported fields

func (*SouinBaseHandler) HandleInternally

func (s *SouinBaseHandler) HandleInternally(r *http.Request) (bool, http.HandlerFunc)

func (*SouinBaseHandler) Revalidate added in v1.6.38

func (s *SouinBaseHandler) Revalidate(validator *rfc.Revalidator, next handlerFunc, customWriter *CustomWriter, rq *http.Request, requestCc *cacheobject.RequestCacheDirectives, cachedKey string) error

func (*SouinBaseHandler) ServeHTTP

func (s *SouinBaseHandler) ServeHTTP(rw http.ResponseWriter, rq *http.Request, next handlerFunc) error

func (*SouinBaseHandler) Store added in v1.6.38

func (s *SouinBaseHandler) Store(
	customWriter *CustomWriter,
	rq *http.Request,
	requestCc *cacheobject.RequestCacheDirectives,
	cachedKey string,
) error

func (*SouinBaseHandler) Upstream

func (s *SouinBaseHandler) Upstream(
	customWriter *CustomWriter,
	rq *http.Request,
	next handlerFunc,
	requestCc *cacheobject.RequestCacheDirectives,
	cachedKey string,
) error

type SouinWriterInterface

type SouinWriterInterface interface {
	Send() (int, error)

Jump to

Keyboard shortcuts

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