Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,18 @@ rate limit, as well as help speed up your application. `go-github` does not
handle conditional requests directly, but is instead designed to work with a
caching `http.Transport`.

Typically, an [RFC 7234](https://datatracker.ietf.org/doc/html/rfc7234)
compliant HTTP cache such as [gregjones/httpcache](https://github.com/gregjones/httpcache)
Typically, an [RFC 9111](https://datatracker.ietf.org/doc/html/rfc9111)
compliant HTTP cache such as [bartventer/httpcache](https://github.com/bartventer/httpcache)
is recommended, ex:

```go
import "github.com/gregjones/httpcache"
import (
"github.com/bartventer/httpcache"
_ "github.com/bartventer/httpcache/store/memcache" // Register the in-memory backend
)

client := github.NewClient(
httpcache.NewMemoryCacheTransport().Client()
httpcache.NewClient("memcache://"),
).WithAuthToken(os.Getenv("GITHUB_TOKEN"))
```

Expand Down
2 changes: 1 addition & 1 deletion github/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ rate limit, as well as help speed up your application. go-github does not
handle conditional requests directly, but is instead designed to work with a
caching [http.Transport].

Typically, an RFC 7234 compliant HTTP cache such as https://github.com/gregjones/httpcache
Typically, an RFC 9111 compliant HTTP cache such as https://github.com/bartventer/httpcache
is recommended. Alternatively, the https://github.com/bored-engineer/github-conditional-http-transport
package relies on (undocumented) GitHub specific cache logic and is
recommended when making requests using short-lived credentials such as a
Expand Down
2 changes: 1 addition & 1 deletion github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Requ
}

// Don't update the rate limits if this was a cached response.
// X-From-Cache is set by https://github.com/gregjones/httpcache
// X-From-Cache is set by https://github.com/bartventer/httpcache
if response.Header.Get("X-From-Cache") == "" {
c.rateMu.Lock()
c.rateLimits[rateLimitCategory] = response.Rate
Expand Down
Loading