(&self)
| 112 | } |
| 113 | |
| 114 | pub async fn get(&self) -> ModelsData { |
| 115 | let data = self.data.read().await; |
| 116 | if let Some(ref d) = *data { |
| 117 | return d.clone(); |
| 118 | } |
| 119 | drop(data); |
| 120 | |
| 121 | self.load().await |
| 122 | } |
| 123 | |
| 124 | async fn load(&self) -> ModelsData { |
| 125 | if let Ok(content) = tokio::fs::read_to_string(&self.cache_path).await { |
no test coverage detected