MCPcopy Create free account
hub / github.com/cli/cli / NewCachedDetector

Function NewCachedDetector

internal/featuredetection/feature_detection.go:211–217  ·  view source on GitHub ↗

NewCachedDetector returns a Detector that probes the given host and caches detection results for the given TTL.

(httpClient *http.Client, host string, ttl time.Duration)

Source from the content-addressed store, hash-verified

209
210// NewCachedDetector returns a Detector that probes the given host and caches detection results for the given TTL.
211func NewCachedDetector(httpClient *http.Client, host string, ttl time.Duration) Detector {
212 return &detector{
213 httpClient: httpClient,
214 host: host,
215 cacheTTL: ttl,
216 }
217}
218
219// client returns the HTTP client for detection requests. If the detector caches results, the client also caches
220// responses with the given extra status codes, which are not cached by default.

Callers 1

TestNewCachedDetectorFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestNewCachedDetectorFunction · 0.68