()
| 64 | |
| 65 | impl MemCache { |
| 66 | pub fn new() -> MemCache { |
| 67 | let map = Arc::new(HashMap::new()); |
| 68 | let map_cln = map.clone(); |
| 69 | let (submit_tx, submit_rx) = channel(PENDING_ADDS); |
| 70 | // This launches our task too. |
| 71 | let _ = tokio::task::spawn(async move { |
| 72 | cache_mgr(map_cln, submit_rx).await |
| 73 | }); |
| 74 | |
| 75 | MemCache { |
| 76 | map, |
| 77 | submit_tx, |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | pub fn get(&self, req_path: &str) -> Option<Arc<MemCacheObj>> { |
| 82 | let rtxn = self.map.read(); |
nothing calls this directly
no test coverage detected