Skip to content

Commit

Permalink
Rename AroundRoundTrip => Around
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed May 17, 2024
1 parent ff2042c commit ef54744
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions httpcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ type Transport struct {
// If true, responses returned from the cache will be given an extra header, X-From-Cache
MarkCachedResponses bool

// AroundRoundTrip is an optional func.
// If set, the Transport will call AroundRoundTrip at the start of RoundTrip
// Around is an optional func.
// If set, the Transport will call Around at the start of RoundTrip
// and defer the returned func until the end of RoundTrip.
// Typically used to implement a lock that is held for the duration of the RoundTrip.
AroundRoundTrip func(key string) func()
Around func(key string) func()
}

// varyMatches will return false unless all of the cached values for the headers listed in Vary
Expand All @@ -134,7 +134,7 @@ func varyMatches(cachedResp *http.Response, req *http.Request) bool {
// will be returned.
func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error) {
cacheKey := cacheKey(req)
if f := t.AroundRoundTrip; f != nil {
if f := t.Around; f != nil {
defer f(cacheKey)()
}
cacheable := (req.Method == "GET" || req.Method == "HEAD") && req.Header.Get("range") == ""
Expand Down

0 comments on commit ef54744

Please sign in to comment.