Documentation ¶
Index ¶
- Variables
- type BaseConfiguration
- func (c *BaseConfiguration) GetAPI() configurationtypes.API
- func (c *BaseConfiguration) GetCacheKeys() configurationtypes.CacheKeys
- func (c *BaseConfiguration) GetDefaultCache() configurationtypes.DefaultCacheInterface
- func (c *BaseConfiguration) GetLogLevel() string
- func (c *BaseConfiguration) GetLogger() core.Logger
- func (c *BaseConfiguration) GetPluginName() string
- 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 core.Logger)
- type CustomWriter
- type SouinBaseHandler
- func (s *SouinBaseHandler) HandleInternally(r *http.Request) (bool, http.HandlerFunc)
- func (s *SouinBaseHandler) Revalidate(validator *core.Revalidator, next handlerFunc, customWriter *CustomWriter, ...) error
- func (s *SouinBaseHandler) ServeHTTP(rw http.ResponseWriter, rq *http.Request, next handlerFunc) error
- func (s *SouinBaseHandler) Store(customWriter *CustomWriter, rq *http.Request, ...) error
- func (s *SouinBaseHandler) Upstream(customWriter *CustomWriter, rq *http.Request, next handlerFunc, ...) error
- type SouinWriterInterface
Constants ¶
This section is empty.
Variables ¶
var Upstream50xError = upstream50xError{}
Functions ¶
This section is empty.
Types ¶
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 core.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 ¶
func (c *BaseConfiguration) GetAPI() configurationtypes.API
GetAPI get the default cache
func (*BaseConfiguration) GetCacheKeys ¶
func (c *BaseConfiguration) GetCacheKeys() configurationtypes.CacheKeys
GetCacheKeys get the cache keys rules to override
func (*BaseConfiguration) GetDefaultCache ¶
func (c *BaseConfiguration) GetDefaultCache() configurationtypes.DefaultCacheInterface
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() core.Logger
GetLogger get the logger
func (*BaseConfiguration) GetPluginName ¶
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 ¶
func (c *BaseConfiguration) GetUrls() map[string]configurationtypes.URL
GetUrls get the urls list in the configuration
func (*BaseConfiguration) GetYkeys ¶
func (c *BaseConfiguration) GetYkeys() map[string]configurationtypes.SurrogateKeys
GetYkeys get the ykeys list
func (*BaseConfiguration) SetLogger ¶
func (c *BaseConfiguration) SetLogger(l core.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 ¶
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 NewHTTPCacheHandler ¶
func NewHTTPCacheHandler(c configurationtypes.AbstractConfigurationInterface) *SouinBaseHandler
func (*SouinBaseHandler) HandleInternally ¶
func (s *SouinBaseHandler) HandleInternally(r *http.Request) (bool, http.HandlerFunc)
func (*SouinBaseHandler) Revalidate ¶
func (s *SouinBaseHandler) Revalidate(validator *core.Revalidator, next handlerFunc, customWriter *CustomWriter, rq *http.Request, requestCc *cacheobject.RequestCacheDirectives, cachedKey string, uri string) error
func (*SouinBaseHandler) ServeHTTP ¶
func (s *SouinBaseHandler) ServeHTTP(rw http.ResponseWriter, rq *http.Request, next handlerFunc) error
func (*SouinBaseHandler) Store ¶
func (s *SouinBaseHandler) Store( customWriter *CustomWriter, rq *http.Request, requestCc *cacheobject.RequestCacheDirectives, cachedKey string, uri string, ) error
func (*SouinBaseHandler) Upstream ¶
func (s *SouinBaseHandler) Upstream( customWriter *CustomWriter, rq *http.Request, next handlerFunc, requestCc *cacheobject.RequestCacheDirectives, cachedKey string, uri string, ) error
type SouinWriterInterface ¶
type SouinWriterInterface interface { http.ResponseWriter Send() (int, error) }