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)
| 209 | |
| 210 | // NewCachedDetector returns a Detector that probes the given host and caches detection results for the given TTL. |
| 211 | func 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. |
no outgoing calls