httpcache

package module
v0.0.0-...-7b5afef Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: MIT Imports: 8 Imported by: 0

README

httpcache

GoDoc

Package httpcache provides a simple http.RoundTripper to cache http responses.

Documentation

Overview

Package httpcache provides a simple http.RoundTripper to cache http responses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key string) ([]byte, bool)
	Set(key string, response []byte)
}

Cache describes how to retrieve and store responses.

type Transport

type Transport struct {
	Transport http.RoundTripper // used to make actual requests.
	Cache     Cache
}

Transport implements http.RoundTripper and returns responses from a cache.

func Custom

func Custom(t http.RoundTripper, c Cache) *Transport

Custom uses t to make actual requests.

func Default

func Default(c Cache) *Transport

Default uses http.DefaultTransport to make actual requests.

func (Transport) RoundTrip

func (t Transport) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip implements the cache logic.

Directories

Path Synopsis
Package disk provides an implementation of httpcache.Cache that uses the filesystem to store http responses.
Package disk provides an implementation of httpcache.Cache that uses the filesystem to store http responses.

Jump to

Keyboard shortcuts

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