response_cache

package
v0.0.0-...-418279d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2017 License: BSD-3-Clause, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Uncacheable = errors.New("Uncacheable")

Functions

func CacheableResponse

func CacheableResponse(status int, header http.Header) bool

func CopyHeader

func CopyHeader(dst, src http.Header)

func HashRequestAndBody

func HashRequestAndBody(req *http.Request) (string, error)

func ReaderAndCloser

func ReaderAndCloser(r io.Reader, cl io.Closer) io.ReadCloser

Types

type DiskCacheHeader

type DiskCacheHeader struct {
	Version int `msg:"version"`

	StatusCode int `msg:"status_code"`

	// equivalent to: Header http.Header `msg:"header"`
	Header map[string][]string `msg:"header"`

	ContentLength int64 `msg:"content_length"`
}

func (*DiskCacheHeader) DecodeMsg

func (z *DiskCacheHeader) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*DiskCacheHeader) EncodeMsg

func (z *DiskCacheHeader) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*DiskCacheHeader) MarshalMsg

func (z *DiskCacheHeader) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*DiskCacheHeader) Msgsize

func (z *DiskCacheHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*DiskCacheHeader) UnmarshalMsg

func (z *DiskCacheHeader) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type File

type File interface {
	io.Reader
	io.ReaderAt
	io.Writer
	io.Closer
	Sync() error
}

type Paths

type Paths []string

type ResponseCache

type ResponseCache interface {
	Clear() error
	Get(key string, miss func() (*http.Response, error)) (*http.Response, error)
}

func NewDiskCache

func NewDiskCache(cacheDirectory string) ResponseCache

type SharedFile

type SharedFile struct {
	// contains filtered or unexported fields
}

func NewSharedFile

func NewSharedFile(f File) *SharedFile

func (*SharedFile) Abort

func (sf *SharedFile) Abort(err error)

func (*SharedFile) Close

func (sf *SharedFile) Close() (err error)

func (*SharedFile) Release

func (sf *SharedFile) Release() (err error)

func (*SharedFile) SpawnReader

func (sf *SharedFile) SpawnReader() (io.ReadCloser, error)

func (*SharedFile) Sync

func (sf *SharedFile) Sync() (err error)

func (*SharedFile) Write

func (sf *SharedFile) Write(p []byte) (n int, err error)

type Upstreams

type Upstreams struct {
	// contains filtered or unexported fields
}

func NewUpstreams

func NewUpstreams(cacheServers string) *Upstreams

func (*Upstreams) UpstreamListed

func (upstreams *Upstreams) UpstreamListed(url *url.URL) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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