httpcache

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: MIT Imports: 16 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 NewClient added in v0.3.1

func NewClient(base *http.Client, options ...Option) *http.Client

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 WithDiscarder added in v0.3.1

func WithDiscarder(discarder Discarder) func(c *option)

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 (Directory) Del

func (d Directory) Del(key string) bool

func (Directory) Get

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

func (Directory) Put

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

type Discarder added in v0.3.1

type Discarder interface {
	Discard(resp Response) bool
}

func NormalDiscarder added in v0.3.1

func NormalDiscarder() Discarder

type DiscarderFunc added in v0.3.1

type DiscarderFunc func(resp Response) bool

func (DiscarderFunc) Discard added in v0.3.1

func (f DiscarderFunc) Discard(resp Response) 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(ms ...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 {
	http.Handler
	// 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 (*Memory) Del

func (m *Memory) Del(key string) bool

func (*Memory) Get

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

func (*Memory) Put

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

type Option

type Option func(c *option)

type Response added in v0.3.1

type Response interface {
	Header() http.Header
	StatusCode() int
}

type RoundTripper

type RoundTripper struct {
	http.RoundTripper
	// 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.ReadCloser, bool)
	Put(key string) (io.WriteCloser, bool)
	Del(key string) bool
}

func DirectoryStorer added in v0.0.2

func DirectoryStorer(dir string) Storer

func MemoryStorer added in v0.0.2

func MemoryStorer() Storer

Jump to

Keyboard shortcuts

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