httpcache

package module
v0.0.0-...-76467e1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2020 License: MIT Imports: 7 Imported by: 0

README

httpcache

Go net/http Middleware for server-side caching

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMiddleware

func NewMiddleware(cache Cache) func(next http.Handler) http.Handler

Types

type Cache

type Cache interface {
	ShouldCached(res *http.Response) bool
	Get(req *http.Request) ([]byte, error)
	Set(req *http.Request, res []byte) error
}

type CachedResponseRecorder

type CachedResponseRecorder struct {
	*httptest.ResponseRecorder
	Body *bytes.Buffer
}

func NewCachedResponseRecorder

func NewCachedResponseRecorder() *CachedResponseRecorder

func (*CachedResponseRecorder) Write

func (t *CachedResponseRecorder) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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