memorycache

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API defines a structure which implements the cache.Cache interface.

func New

func New(name string) *API

New returns a new instance of the API struct.

func (*API) Add

func (a *API) Add(req string, res *http.Response) error

Add adds the giving response object into the cache.

func (*API) AddData

func (a *API) AddData(req string, res []byte) error

AddData adds the giving data object into the cache.

func (*API) All

func (a *API) All() ([]cache.WebPair, error)

All returns all the pairs of requests which have been added into the cache in

func (*API) Delete

func (a *API) Delete(path string) error

Delete removes the giving path from the underline cache if found.

func (*API) DeleteRequest

func (a *API) DeleteRequest(w cache.Request) error

DeleteRequest removes the underline request from the cache.

func (*API) Empty

func (a *API) Empty() error

Empty deletes all giving requests from the underline cache.

func (*API) Get

func (a *API) Get(path string) (cache.Request, cache.Response, error)

Get calls CacheAPI.MatchPath and passing in a default MatchAttr value.

func (*API) GetRequest

func (a *API) GetRequest(w cache.Request) (cache.Response, error)

GetRequest calls CacheAPI.Match and passing in a default MatchAttr value.

func (*API) Put

func (a *API) Put(req cache.Request, res cache.Response) error

Put calls the internal caches.Cache.Put function matching against the

func (*API) PutPath

func (a *API) PutPath(path string, res cache.Response) error

PutPath calls the internal caches.Cache.Put function matching against the

func (*API) Serve

func (a *API) Serve(w http.ResponseWriter, r *http.Request) error

Serve attempts to find the request and serve the response into the provided http.ResponseWriter.

func (*API) String

func (a *API) String() string

String returns a json version of the internal array of pairs.

Jump to

Keyboard shortcuts

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