api

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const CacheGetPath = "/{any:*}"

CacheGetPath for getting pagedata from cache via HTTP.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheProxyController

type CacheProxyController struct {
	// contains filtered or unexported fields
}

CacheProxyController handles cache API requests (read/write-through, error reporting, metrics).

func NewCacheProxyController

func NewCacheProxyController(
	ctx context.Context,
	cfg config.Config,
	cache storage.Storage,
	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

func (c *CacheProxyController) AddRoute(router *router.Router)

AddRoute attaches controller's route(s) to the provided router.

func (*CacheProxyController) Index

func (c *CacheProxyController) Index(ctx *fasthttp.RequestCtx)

Index is the main HTTP handler.

type ChangeBackendPolicyController

type ChangeBackendPolicyController struct {
}

func NewChangeBackendPolicyController

func NewChangeBackendPolicyController() *ChangeBackendPolicyController

func (*ChangeBackendPolicyController) AddRoute

func (*ChangeBackendPolicyController) TurnOnAwaitPolicy

func (c *ChangeBackendPolicyController) TurnOnAwaitPolicy(ctx *fasthttp.RequestCtx)

func (*ChangeBackendPolicyController) TurnOnDenyPolicy

func (c *ChangeBackendPolicyController) TurnOnDenyPolicy(ctx *fasthttp.RequestCtx)

type ClearController

type ClearController struct {
	// contains filtered or unexported fields
}

func NewClearController

func NewClearController(cfg config.Config, db storage.Storage) *ClearController

func (*ClearController) AddRoute

func (c *ClearController) AddRoute(r *router.Router)

func (*ClearController) HandleClear

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 ClearOneController

type ClearOneController struct {
	// contains filtered or unexported fields
}

func NewMarkOutdatedController

func NewMarkOutdatedController(cfg config.Config, db storage.Storage) *ClearOneController

func (*ClearOneController) AddRoute

func (c *ClearOneController) AddRoute(r *router.Router)

func (*ClearOneController) HandleClear

func (c *ClearOneController) HandleClear(ctx *fasthttp.RequestCtx)

type HttpCompressionController

type HttpCompressionController struct {
	// contains filtered or unexported fields
}

func NewHttpCompressionController

func NewHttpCompressionController() *HttpCompressionController

func (*HttpCompressionController) AddRoute

func (c *HttpCompressionController) AddRoute(r *router.Router)

func (*HttpCompressionController) Get

func (*HttpCompressionController) Off

func (*HttpCompressionController) On

type OnOffController

type OnOffController struct {
	// contains filtered or unexported fields
}

OnOffController provides endpoints to switch the advanced cache on and off.

func NewOnOffController

func NewOnOffController(cfg config.Config) *OnOffController

NewOnOffController creates a new OnOffController instance.

func (*OnOffController) AddRoute

func (c *OnOffController) AddRoute(r *router.Router)

AddRoute attaches the on/off routes to the given router.

func (*OnOffController) Off

func (c *OnOffController) Off(ctx *fasthttp.RequestCtx)

Off handles POST /adv-cache/off and disables the advanced cache, returning JSON.

func (*OnOffController) On

func (c *OnOffController) On(ctx *fasthttp.RequestCtx)

On handles POST /adv-cache/on and enables the advanced cache, returning JSON.

Jump to

Keyboard shortcuts

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