Plugins: share http cache (#18152)
This commit is contained in:
parent
9308876bad
commit
ba96fbbc71
1 changed files with 6 additions and 3 deletions
|
|
@ -34,6 +34,8 @@ func init() {
|
|||
registry.AddCtx("http", NewHTTPProviderFromConfig)
|
||||
}
|
||||
|
||||
var mc = httpcache.NewMemoryCache()
|
||||
|
||||
// Auth is the authorization config
|
||||
type Auth struct {
|
||||
Type, User, Password string
|
||||
|
|
@ -101,9 +103,10 @@ func NewHTTP(log *util.Logger, method, uri string, insecure bool, cache time.Dur
|
|||
}
|
||||
|
||||
// http cache
|
||||
cacheTransport := httpcache.NewMemoryCacheTransport()
|
||||
cacheTransport.Transport = p.Client.Transport
|
||||
p.Client.Transport = cacheTransport
|
||||
p.Client.Transport = &httpcache.Transport{
|
||||
Cache: mc,
|
||||
Transport: p.Client.Transport,
|
||||
}
|
||||
|
||||
// ignore the self signed certificate
|
||||
if insecure {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue