Removes expired cache entries.
(context: &Context)
| 245 | |
| 246 | /// Removes expired cache entries. |
| 247 | pub(crate) async fn http_cache_cleanup(context: &Context) -> Result<()> { |
| 248 | // Remove cache entries that are already expired |
| 249 | // or entries that will not expire in a year |
| 250 | // to make sure we don't have invalid timestamps that are way forward in the future. |
| 251 | context |
| 252 | .sql |
| 253 | .execute( |
| 254 | "DELETE FROM http_cache |
| 255 | WHERE ?1 > expires OR expires > ?1 + 31536000", |
| 256 | (time(),), |
| 257 | ) |
| 258 | .await?; |
| 259 | Ok(()) |
| 260 | } |
| 261 | |
| 262 | /// Fetches URL and updates the cache. |
| 263 | /// |
no test coverage detected