httpcache

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 18 Imported by: 0

README

Caddy Cache-Handler

Go

Build

export GOOS=linux
export GOARCH=amd64
xcaddy build --with github.com/golevi/cache-handler
tar -czf caddy.tar.gz caddy

Contributing

Good reads:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Config config.Config
	Store  stores.CacheStore

	// Validators check to see whether the request should be cached.
	Validators []func(c config.Config, w http.ResponseWriter, r *http.Request) bool
	// contains filtered or unexported fields
}

Cache is the primary struct for Caddy to use. It contains the config, cache store, validators, and the logger.

func (Cache) CaddyModule

func (Cache) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*Cache) Provision

func (c *Cache) Provision(ctx caddy.Context) error

Provision _

func (*Cache) ServeHTTP

func (c *Cache) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

func (*Cache) UnmarshalCaddyfile

func (c *Cache) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile parses plugin settings from Caddyfile.

{
	order cache first
	cache {
		type <redis>|<file>
		host localhost:6379
	}
}

cache {
	expire 120                              # Cache expiration in seconds
	bypass {
		paths wp-admin wp-login.php system  # WordPress and ExpressionEngine
		methods post                        # Don't typically cache POST
		cookies wordpress_logged_in_.*      # WordPress
		# cookie exp_sessionid              # ExpressionEngine
	}
}

This may change.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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