client

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is an enhanced http.Client. By defualt, a caching layer is used for GET requests.

func New

func New() *Client

New returns a new Client instance.

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do sends the request, maybe caches the response, and returns the response.

func (*Client) SetCacheKeyPrefix

func (c *Client) SetCacheKeyPrefix(prefix string) *Client

SetCacheKeyPrefix sets the prefix for all of its cache keys.

func (*Client) SetCacher

func (c *Client) SetCacher(cacher cache.Cacher) *Client

SetCacher sets the client's Cacher.

func (*Client) SetHTTPClient

func (c *Client) SetHTTPClient(httpClient *http.Client) *Client

SetHTTPClient sets the Client's http.Client.

func (*Client) SetSkipCache

func (c *Client) SetSkipCache(skip bool) *Client

SetSkipCache sets the skipCache option; true to bypass the cache, otherwise cache responses.

func (*Client) SetTTL

func (c *Client) SetTTL(ttl time.Duration) *Client

SetTTL sets the Time to Live (TTL) for a request's cached response.

Jump to

Keyboard shortcuts

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