(url: String, config: Config)
| 149 | } |
| 150 | |
| 151 | fn set_cached(url: String, config: Config) { |
| 152 | let mut guard = match CACHE.lock() { |
| 153 | Ok(g) => g, |
| 154 | Err(_) => return, |
| 155 | }; |
| 156 | let map = guard.get_or_insert_with(HashMap::new); |
| 157 | map.insert( |
| 158 | url, |
| 159 | CacheEntry { |
| 160 | config, |
| 161 | fetched_at: Instant::now(), |
| 162 | }, |
| 163 | ); |
| 164 | } |
| 165 | |
| 166 | /// Clears the wellknown config cache. Useful for testing or forced refresh. |
| 167 | pub fn clear_cache() { |
no outgoing calls