apicache

package
v0.0.0-...-dbefbc8 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHTTPClient

func CreateHTTPClient() *http.Client

CreateHTTPClientCache creates an error limiting client with auto retry and no cache

func CreateHTTPClientCache

func CreateHTTPClientCache(redis *redis.Pool) *http.Client

CreateHTTPClientCache creates an error limiting client with auto retry and redis cache

func CreateLimitedHTTPClientCache

func CreateLimitedHTTPClientCache(redis *redis.Pool) *http.Client

CreateLimitedHTTPClientCache creates an error limiting client with auto retry, redis cache, and limit it to 100 connections

Types

type APICacheTransport

type APICacheTransport struct {
	Transport http.RoundTripper
}

APICacheTransport to chain into the HTTPClient to gather statistics.

func (*APICacheTransport) RoundTrip

func (t *APICacheTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip wraps http.DefaultTransport.RoundTrip to provide stats and handle error rates.

type LimitedTransport

type LimitedTransport struct {
	Transport http.RoundTripper
}

LimitedTransport limits concurrent requests to one connection.

func (*LimitedTransport) RoundTrip

func (t *LimitedTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip wraps http.DefaultTransport.RoundTrip to provide stats and handle error rates.

Jump to

Keyboard shortcuts

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