Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fetch ¶ added in v1.9.1
func Fetch(ctx context.Context, ch chan<- FetcherResponse, name string, g func(context.Context) ([]apiclient.APIResponse, error))
Fetch is a convenience function. It calls an API and sends the data back to the cache. If the API fails, the call will be retried maxRetries number of times
Types ¶
type Cache ¶
type Cache struct { Fetchers []Fetcher // contains filtered or unexported fields }
Cache holds a list of measurements
func (*Cache) Get ¶
func (c *Cache) Get(name string) (entries []apiclient.APIResponse, found bool)
Get retrieves a cached item
type Fetcher ¶
type Fetcher interface {
Update(ctx context.Context, ch chan<- FetcherResponse)
}
Fetcher interface contains all functions an API interface needs to implement to be used by Cache
type FetcherResponse ¶ added in v1.9.1
type FetcherResponse struct { Name string Response []apiclient.APIResponse }
FetcherResponse contains one update from a Fetcher
Click to show internal directories.
Click to hide internal directories.