cache

package
v0.0.0-...-b405234 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package cache handles HTTP caching headers on responses that are cacheable.

Index

Constants

View Source
const (
	// MinEdgeTime is the minimum amount of time a response needs to be cached to be
	// picked up in the Google front-end edge cache (i.e., their massively distributed one).
	MinEdgeTime = 61 * time.Second
)

Variables

This section is empty.

Functions

func Response

Response wraps the provided kami.HandlerFunc with an HTTP cache. If the underlying handler writes http.StatusOK, Response will set headers to cache the response for the specified duration. Otherwise, Response will set headers ensuring the result is not cached.

Response understands which HTTP responses are public and which are authenticated, and it sets the Cache-Control header to public and private appropriately.

Types

type CachingResponseWriter

type CachingResponseWriter struct {
	http.ResponseWriter
	Duration time.Duration
	Public   bool
	// contains filtered or unexported fields
}

func (*CachingResponseWriter) Write

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

func (*CachingResponseWriter) WriteHeader

func (w *CachingResponseWriter) WriteHeader(code int)

Jump to

Keyboard shortcuts

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