cache

package
v1.0.25 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get added in v1.0.17

func Get(key string) (interface{}, bool)

Get a value from cache.

func HandlerWrapper added in v1.0.17

func HandlerWrapper(cacheDuration int, next http.Handler) http.HandlerFunc

HandlerWrapper caches all interactions with the API based on Method, URI, and status code for the wrapped handler. cacheDuration is in seconds.

func Set added in v1.0.17

func Set(key string, value interface{})

Set a value in cache.

func SetWithDuration added in v1.0.17

func SetWithDuration(key string, value interface{}, d time.Duration)

SetWithDuration sets a value in cache.

Types

type ResponseWriterTee

type ResponseWriterTee struct {
	Buffer     bytes.Buffer
	StatusCode int
	// contains filtered or unexported fields
}

ResponseWriterTee captures input to an http.ResponseWriter

func (*ResponseWriterTee) Header

func (w *ResponseWriterTee) Header() http.Header

Header proxies http.ResponseWriter Header

func (*ResponseWriterTee) Write

func (w *ResponseWriterTee) Write(b []byte) (int, error)

Write proxies http.ResponseWriter Write

func (*ResponseWriterTee) WriteHeader

func (w *ResponseWriterTee) WriteHeader(statusCode int)

WriteHeader proxies http.ResponseWriter WriteHeader

Jump to

Keyboard shortcuts

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