Help us shape the future of Go! Take the 2026 Go Developer Survey

types

package
v1.6.45 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbstractProviderInterface

type AbstractProviderInterface interface {
	ListKeys() []string
	Prefix(key string, req *http.Request) []byte
	Get(key string) []byte
	Set(key string, value []byte, url configurationtypes.URL, duration time.Duration) error
	Delete(key string)
	DeleteMany(key string)
	Init() error
	Reset() error
}

AbstractProviderInterface should be implemented in any providers

type AbstractReconnectProvider added in v1.6.19

type AbstractReconnectProvider interface {
	AbstractProviderInterface
	Reconnect()
}

type CoalescingLayerStorage

type CoalescingLayerStorage struct {
	*ristretto.Cache
}

CoalescingLayerStorage is the layer to be able to not coalesce uncoalesceable request

func InitializeCoalescingLayerStorage

func InitializeCoalescingLayerStorage() *CoalescingLayerStorage

InitializeCoalescingLayerStorage initialize the storage

func (*CoalescingLayerStorage) Delete

func (provider *CoalescingLayerStorage) Delete(key string)

Delete method will delete the response in Ristretto provider if exists corresponding to key param

func (*CoalescingLayerStorage) Destruct added in v1.6.9

func (provider *CoalescingLayerStorage) Destruct() error

Destruct method will shutdown properly the provider

func (*CoalescingLayerStorage) Exists

func (provider *CoalescingLayerStorage) Exists(key string) bool

Exists method returns if the key should coalesce

func (*CoalescingLayerStorage) Set

func (provider *CoalescingLayerStorage) Set(key string)

Set method will store the response in Ristretto provider

type RetrieverResponseProperties

type RetrieverResponseProperties struct {
	Provider      AbstractProviderInterface
	Configuration configurationtypes.AbstractConfigurationInterface
	MatchedURL    configurationtypes.URL
	RegexpUrls    regexp.Regexp
	Transport     TransportInterface
	ExcludeRegex  *regexp.Regexp
	Context       *context.Context
}

RetrieverResponseProperties struct

func (*RetrieverResponseProperties) GetConfiguration

GetConfiguration get the configuration

func (*RetrieverResponseProperties) GetContext

func (r *RetrieverResponseProperties) GetContext() *context.Context

GetContext get the different contexts to init/use

func (*RetrieverResponseProperties) GetExcludeRegexp

func (r *RetrieverResponseProperties) GetExcludeRegexp() *regexp.Regexp

GetExcludeRegexp get the excluded regexp

func (*RetrieverResponseProperties) GetMatchedURL

GetMatchedURL get the matched url

func (*RetrieverResponseProperties) GetProvider

GetProvider interface

func (*RetrieverResponseProperties) GetRegexpUrls

func (r *RetrieverResponseProperties) GetRegexpUrls() *regexp.Regexp

GetRegexpUrls get the regexp urls

func (*RetrieverResponseProperties) GetTransport

GetTransport get the transport according to the RFC

func (*RetrieverResponseProperties) SetMatchedURL

func (r *RetrieverResponseProperties) SetMatchedURL(url configurationtypes.URL)

SetMatchedURL set the matched url

func (*RetrieverResponseProperties) SetMatchedURLFromRequest

func (r *RetrieverResponseProperties) SetMatchedURLFromRequest(req *http.Request)

SetMatchedURLFromRequest set the matched url from the request

func (*RetrieverResponseProperties) SetTransport

func (r *RetrieverResponseProperties) SetTransport(transportInterface TransportInterface)

SetTransport set the transport

type RetrieverResponsePropertiesInterface

type RetrieverResponsePropertiesInterface interface {
	GetProvider() AbstractProviderInterface
	GetConfiguration() configurationtypes.AbstractConfigurationInterface
	GetMatchedURL() configurationtypes.URL
	SetMatchedURL(url configurationtypes.URL)
	SetMatchedURLFromRequest(*http.Request)
	GetRegexpUrls() *regexp.Regexp
	GetTransport() TransportInterface
	SetTransport(TransportInterface)
	GetExcludeRegexp() *regexp.Regexp
	GetContext() *context.Context
}

RetrieverResponsePropertiesInterface interface

type Transport

type Transport struct {
	// The RoundTripper interface actually used to make requests
	// If nil, http.DefaultTransport is used
	Transport              http.RoundTripper
	Provider               AbstractProviderInterface
	ConfigurationURL       configurationtypes.URL
	MarkCachedResponses    bool
	CoalescingLayerStorage *CoalescingLayerStorage
	YkeyStorage            *ykeys.YKeyStorage
	SurrogateStorage       providers.SurrogateInterface
}

Transport is an implementation of http.RoundTripper that will return values from a cache where possible (avoiding a network request) and will additionally add validators (etag/if-modified-since) to repeated requests allowing servers to return 304 / Not Modified

type TransportInterface

type TransportInterface interface {
	GetProvider() AbstractProviderInterface
	RoundTrip(req *http.Request) (resp *http.Response, err error)
	SetURL(url configurationtypes.URL)
	UpdateCacheEventually(req *http.Request) (resp *http.Response, err error)
	GetCoalescingLayerStorage() *CoalescingLayerStorage
	GetYkeyStorage() *ykeys.YKeyStorage
	GetSurrogateKeys() providers.SurrogateInterface
	SetSurrogateKeys(providers.SurrogateInterface)
}

TransportInterface interface

Jump to

Keyboard shortcuts

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