httpcache

package module
Version: v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: MIT Imports: 15 Imported by: 2

README

httpcache

http cache library

Go Report Card GoDoc GitHub license gocover.io

License

Licensed under the MIT License. See LICENSE for the full license text.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler added in v0.2.0

func NewHandler(base http.Handler, options ...Option) http.Handler

func NewRoundTripper

func NewRoundTripper(base http.RoundTripper, options ...Option) http.RoundTripper

func WithFilterer

func WithFilterer(filterer Filterer) func(c *option)

func WithKeyer

func WithKeyer(keyer Keyer) func(c *option)

func WithStorer

func WithStorer(storer Storer) func(c *option)

Types

type Directory

type Directory string

func DirectoryStorer added in v0.0.2

func DirectoryStorer(dir string) Directory

func (Directory) Del

func (d Directory) Del(key string)

func (Directory) Get

func (d Directory) Get(key string) (io.Reader, bool)

func (Directory) Put

func (d Directory) Put(key string) (io.WriteCloser, bool)

type Filterer

type Filterer interface {
	Filter(req *http.Request) bool
}

func AndJointFilterer added in v0.0.2

func AndJointFilterer(filterers ...Filterer) Filterer

func MethodFilterer added in v0.0.2

func MethodFilterer(m string) Filterer

func OrJointFilterer added in v0.0.2

func OrJointFilterer(filterers ...Filterer) Filterer

func PrefixFilterer added in v0.0.2

func PrefixFilterer(prefix string) Filterer

type FiltererFunc

type FiltererFunc func(req *http.Request) bool

func (FiltererFunc) Filter

func (f FiltererFunc) Filter(req *http.Request) bool

type Handler added in v0.2.0

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

func (*Handler) ServeHTTP added in v0.2.0

func (h *Handler) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type Keyer

type Keyer interface {
	Key(req *http.Request) string
}

func BodyKeyer added in v0.0.2

func BodyKeyer() Keyer

func HeaderKeyer added in v0.0.3

func HeaderKeyer(names ...string) Keyer

func HostKeyer added in v0.2.0

func HostKeyer() Keyer

func JointKeyer added in v0.0.2

func JointKeyer(keyers ...Keyer) Keyer

func MethodKeyer added in v0.0.2

func MethodKeyer() Keyer

func PathKeyer added in v0.0.2

func PathKeyer() Keyer

func QueryKeyer added in v0.0.2

func QueryKeyer(names ...string) Keyer

type KeyerFunc

type KeyerFunc func(req *http.Request) string

func (KeyerFunc) Key

func (k KeyerFunc) Key(req *http.Request) string

type Memory

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

func MemoryStorer added in v0.0.2

func MemoryStorer() *Memory

func (*Memory) Del

func (m *Memory) Del(key string)

func (*Memory) Get

func (m *Memory) Get(key string) (io.Reader, bool)

func (*Memory) Put

func (m *Memory) Put(key string) (io.WriteCloser, bool)

type Option

type Option func(c *option)

type RoundTripper

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

func (*RoundTripper) RoundTrip

func (r *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type Storer

type Storer interface {
	Get(key string) (io.Reader, bool)
	Put(key string) (io.WriteCloser, bool)
	Del(key string)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL