MCPcopy Index your code
hub / github.com/ContentSquare/chproxy / shouldRespondFromCache

Function shouldRespondFromCache

proxy.go:176–192  ·  view source on GitHub ↗
(s *scope, origParams url.Values, req *http.Request)

Source from the content-addressed store, hash-verified

174}
175
176func shouldRespondFromCache(s *scope, origParams url.Values, req *http.Request) ([]byte, bool, error) {
177 if s.user.cache == nil || s.user.cache.Cache == nil {
178 return nil, false, nil
179 }
180
181 noCache := origParams.Get("no_cache")
182 if noCache == "1" || noCache == "true" {
183 return nil, false, nil
184 }
185
186 q, err := getFullQuery(req)
187 if err != nil {
188 return nil, false, fmt.Errorf("%s: cannot read query: %w", s, err)
189 }
190
191 return q, canCacheQuery(q), nil
192}
193
194func executeWithRetry(
195 ctx context.Context,

Callers 1

ServeHTTPMethod · 0.85

Calls 3

getFullQueryFunction · 0.85
canCacheQueryFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected