(&self, udid: &str)
| 174 | } |
| 175 | |
| 176 | fn latest_interactive(&self, udid: &str) -> Option<Value> { |
| 177 | let mut cache = self |
| 178 | .inner |
| 179 | .lock() |
| 180 | .unwrap_or_else(|poisoned| poisoned.into_inner()); |
| 181 | let now = Instant::now(); |
| 182 | cache.retain(|_, cached| { |
| 183 | now.duration_since(cached.cached_at) <= ACCESSIBILITY_TREE_CACHE_TTL |
| 184 | }); |
| 185 | cache |
| 186 | .iter() |
| 187 | .filter(|(key, _)| key.udid == udid && key.interactive_only && !key.include_hidden) |
| 188 | .max_by_key(|(_, cached)| cached.cached_at) |
| 189 | .map(|(_, cached)| cached.snapshot.clone()) |
| 190 | } |
| 191 | |
| 192 | fn invalidate(&self, udid: &str) { |
| 193 | let mut generations = self |
no test coverage detected