httpcache

package
v0.132.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Cache: Cache{
		For: GlobMatcher{
			Excludes: []string{"**"},
		},
	},
	Polls: []PollConfig{
		{
			For: GlobMatcher{
				Includes: []string{"**"},
			},
			Disable: true,
		},
	},
}

DefaultConfig holds the default configuration for the HTTP cache.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// Enable HTTP cache behaviour (RFC 9111) for these rsources.
	For GlobMatcher
}

type Config

type Config struct {
	// Configures the HTTP cache behaviour (RFC 9111).
	// When this is not enabled for a resource, Hugo will go straight to the file cache.
	Cache Cache

	// Polls holds a list of configurations for polling remote resources to detect changes in watch mode.
	// This can be disabled for some resources, typically if they are known to not change.
	Polls []PollConfig
}

Config holds the configuration for the HTTP cache.

func DecodeConfig

func DecodeConfig(bcfg config.BaseConfig, m map[string]any) (Config, error)

func (*Config) Compile

func (c *Config) Compile() (ConfigCompiled, error)

type ConfigCompiled

type ConfigCompiled struct {
	For         predicate.P[string]
	PollConfigs []PollConfigCompiled
}

func (*ConfigCompiled) IsPollingDisabled

func (c *ConfigCompiled) IsPollingDisabled() bool

func (*ConfigCompiled) PollConfigFor

func (c *ConfigCompiled) PollConfigFor(s string) PollConfigCompiled

type GlobMatcher

type GlobMatcher struct {
	// Excludes holds a list of glob patterns that will be excluded.
	Excludes []string

	// Includes holds a list of glob patterns that will be included.
	Includes []string
}

func (*GlobMatcher) CompilePredicate

func (gm *GlobMatcher) CompilePredicate() (func(string) bool, error)

type PollConfig

type PollConfig struct {
	// What remote resources to apply this configuration to.
	For GlobMatcher

	// Disable polling for this configuration.
	Disable bool

	// Low is the lower bound for the polling interval.
	// This is the starting point when the resource has recently changed,
	// if that resource stops changing, the polling interval will gradually increase towards High.
	Low time.Duration

	// High is the upper bound for the polling interval.
	// This is the interval used when the resource is stable.
	High time.Duration
}

PollConfig holds the configuration for polling remote resources to detect changes in watch mode.

func (PollConfig) MarshalJSON

func (c PollConfig) MarshalJSON() (b []byte, err error)

type PollConfigCompiled

type PollConfigCompiled struct {
	For    predicate.P[string]
	Config PollConfig
}

func (PollConfigCompiled) IsZero

func (p PollConfigCompiled) IsZero() bool

Jump to

Keyboard shortcuts

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