From 75aa3d092490567b85c52e9624f36c719e57f673 Mon Sep 17 00:00:00 2001 From: Bart Venter Date: Fri, 27 Jun 2025 13:13:45 +0200 Subject: [PATCH] docs: Update HTTP cache references to RFC 9111 compliant implementation --- README.md | 11 +++++++---- github/doc.go | 2 +- github/github.go | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 82e69a9e33c..aa269eb5f20 100644 --- a/README.md +++ b/README.md @@ -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")) ``` diff --git a/github/doc.go b/github/doc.go index f85faed839a..844008d57a6 100644 --- a/github/doc.go +++ b/github/doc.go @@ -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 diff --git a/github/github.go b/github/github.go index 89c6ea4ef73..0e2a9950c29 100644 --- a/github/github.go +++ b/github/github.go @@ -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