cachecontrol

package
v1.24.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: Apache-2.0 Imports: 3 Imported by: 3 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cachecontrol creates a cache control echo middleware

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Skipper: middleware.DefaultSkipper,
	NoCacheHeaders: map[string]string{
		"Expires":         epoch,
		"Cache-Control":   "no-cache, private, max-age=0",
		"Pragma":          "no-cache",
		"X-Accel-Expires": "0",
	},
	EtagHeaders: []string{
		"ETag",
		"If-Modified-Since",
		"If-Match",
		"If-None-Match",
		"If-Range",
		"If-Unmodified-Since",
	},
}

DefaultConfig is the default configuration of the middleware

Functions

func New

func New() echo.MiddlewareFunc

New creates a new middleware function with the default config

func NewWithConfig

func NewWithConfig(config Config) echo.MiddlewareFunc

NewWithConfig returns a new router middleware handler

Types

type Config

type Config struct {
	Enabled bool `json:"enabled" koanf:"enabled" default:"true"`
	// Skipper defines a function to skip middleware
	Skipper middleware.Skipper `json:"-" koanf:"-"`
	// noCacheHeaders is the header <-> match map pair to match in http for entity headers to remove
	NoCacheHeaders map[string]string `json:"nocacheheaders" koanf:"nocacheheaders"`
	// etagHeaders is the string of entity headers to remove
	EtagHeaders []string `json:"etagheaders" koanf:"etagheaders"`
}

Config is the config values for the cache-control middleware

Jump to

Keyboard shortcuts

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