mirror of
https://github.com/therootcompany/golib.git
synced 2026-11-04 06:55:00 +00:00
fix(httpcache): use fast internal HTTP client by default
This commit is contained in:
parent
50bbb2475e
commit
054e238804
@ -1,5 +1,8 @@
|
||||
module github.com/therootcompany/golib/net/httpcache
|
||||
|
||||
go 1.26.0
|
||||
go 1.26.5
|
||||
|
||||
require golang.org/x/sync v0.20.0
|
||||
require (
|
||||
github.com/therootcompany/golib/https v0.9.0
|
||||
golang.org/x/sync v0.20.0
|
||||
)
|
||||
|
||||
@ -1,2 +1,4 @@
|
||||
github.com/therootcompany/golib/https v0.9.0 h1:D9gh0K6ljkvF805JUbylITn8SHPMo08q5PglQGXsK8c=
|
||||
github.com/therootcompany/golib/https v0.9.0/go.mod h1:ilExqR/Uh7oB36oy9mwuNhANcFh+zdCfD3uJiZ11YAY=
|
||||
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
||||
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
|
||||
@ -14,6 +14,7 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/therootcompany/golib/https"
|
||||
"golang.org/x/sync/singleflight"
|
||||
)
|
||||
|
||||
@ -139,11 +140,11 @@ func (c *Cacher) saveMeta() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// New creates a Cacher with a default *http.Client (5s connect, 5m overall).
|
||||
// Equivalent to NewWith(url, path, nil). Header is read live on every request,
|
||||
// so it may be set or modified after New.
|
||||
// New creates a Cacher with golib's fast internal HTTP client.
|
||||
// Equivalent to NewWith(url, path, https.NewInternalClient()). Header is read
|
||||
// live on every request, so it may be set or modified after New.
|
||||
func New(url, path string) *Cacher {
|
||||
return NewWith(url, path, nil)
|
||||
return NewWith(url, path, https.NewInternalClient())
|
||||
}
|
||||
|
||||
// NewWith creates a Cacher backed by the given *http.Client; pass nil for
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user