Gets an entry from the cache, checking for expiration. Returns the cached file list if it exists and hasn't expired. If the entry has expired, it is removed from the cache.
(&mut self, key: &TableScopedPath, now: Instant)
| 202 | /// Returns the cached file list if it exists and hasn't expired. |
| 203 | /// If the entry has expired, it is removed from the cache. |
| 204 | fn get(&mut self, key: &TableScopedPath, now: Instant) -> Option<CachedFileList> { |
| 205 | let entry = self.lru_queue.get(key)?; |
| 206 | |
| 207 | // Check expiration |
| 208 | if let Some(exp) = entry.expires |
| 209 | && now > exp |
| 210 | { |
| 211 | self.remove(key); |
| 212 | return None; |
| 213 | } |
| 214 | |
| 215 | Some(entry.metas.clone()) |
| 216 | } |
| 217 | |
| 218 | /// Checks if the respective entry is currently cached. |
| 219 | /// |