Documentation
¶
Index ¶
Constants ¶
const CacheGetPath = "/{any:*}"
CacheGetPath for getting pagedata from cache via HTTP.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheProxyController ¶ added in v1.1.1
type CacheProxyController struct {
// contains filtered or unexported fields
}
CacheProxyController handles cache API requests (read/write-through, error reporting, metrics).
func NewCacheProxyController ¶ added in v1.1.1
func NewCacheProxyController( ctx context.Context, cfg config.Config, cache storage.Storage, metrics metrics.Meter, backend upstream.Upstream, ) *CacheProxyController
NewCacheProxyController builds a cache API controller with all dependencies. If debug is enabled, launches internal stats logger goroutine.
func (*CacheProxyController) AddRoute ¶ added in v1.1.1
func (c *CacheProxyController) AddRoute(router *router.Router)
AddRoute attaches controller's route(s) to the provided router.
func (*CacheProxyController) Index ¶ added in v1.1.1
func (c *CacheProxyController) Index(ctx *fasthttp.RequestCtx)
Index is the main HTTP handler.
type ClearController ¶ added in v0.9.7
type ClearController struct {
// contains filtered or unexported fields
}
func NewClearController ¶ added in v0.9.7
func NewClearController(cfg config.Config, db storage.Storage) *ClearController
func (*ClearController) AddRoute ¶ added in v0.9.7
func (c *ClearController) AddRoute(r *router.Router)
func (*ClearController) HandleClear ¶ added in v0.9.7
func (c *ClearController) HandleClear(ctx *fasthttp.RequestCtx)
HandleClear is mounted at GET /cache/clear. Without ?token, returns a valid token (5min TTL). With ?token, validates, clears storage, logs, and returns status.
type OnOffController ¶ added in v0.9.7
type OnOffController struct {
// contains filtered or unexported fields
}
OnOffController provides endpoints to switch the advanced cache on and off.
func NewOnOffController ¶ added in v0.9.7
func NewOnOffController(cfg config.Config) *OnOffController
NewOnOffController creates a new OnOffController instance.
func (*OnOffController) AddRoute ¶ added in v0.9.7
func (c *OnOffController) AddRoute(r *router.Router)
AddRoute attaches the on/off routes to the given router.
func (*OnOffController) Off ¶ added in v0.9.7
func (c *OnOffController) Off(ctx *fasthttp.RequestCtx)
Off handles POST /adv-cache/off and disables the advanced cache, returning JSON.
func (*OnOffController) On ¶ added in v0.9.7
func (c *OnOffController) On(ctx *fasthttp.RequestCtx)
On handles POST /adv-cache/on and enables the advanced cache, returning JSON.