httpcache

package module
v0.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: MIT Imports: 13 Imported by: 0

README

Caddy Cache-Handler

Comes with Redis.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Config

	Store CacheStore
	// contains filtered or unexported fields
}

Cache stuff

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 sets up the handler from Caddyfile tokens. Syntax:

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

This may change.

type CacheStore

type CacheStore interface {
	Get(key string) (interface{}, error)
	Has(key string) bool
	Put(key string, value interface{}, expiration time.Duration)
}

CacheStore represents a way to cache

type Config

type Config struct {
	Type string `json:"type,omitempty"`
	Host string `json:"host,omitempty"`

	Bypass []string `json:"bypass"`
	Expire int      `json:"expire"`
}

Config options

Directories

Path Synopsis
stores

Jump to

Keyboard shortcuts

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