Document caching; increase Luchtmeetnet caching to 30min

This commit is contained in:
Paul van Tilburg 2022-02-14 21:40:07 +01:00
parent 79981314d3
commit 0c5367f87f
Signed by untrusted user: paul
GPG Key ID: C6DE073EDA9EEC4D
3 changed files with 10 additions and 1 deletions

View File

@ -181,6 +181,9 @@ async fn forecast(
///
/// Returns [`Some`] with tuple of latitude and longitude. Returns [`None`] if the address could
/// not be geocoded or the OpenStreetMap Nomatim API could not be contacted.
///
/// If the result is [`Some`] it will be cached. Only the 100 least-recently used address
/// will be cached.
#[cached(size = 100)]
async fn address_position(address: String) -> Option<(f64, f64)> {
println!("🌍 Geocoding the position of the address: {}", address);

View File

@ -90,6 +90,9 @@ fn convert_value(v: u16) -> f32 {
///
/// Returns [`None`] if retrieval or deserialization fails, or if the metric is not supported by
/// this provider.
///
/// If the result is [`Some`] it will be cached for 5 minutes for the the given position and
/// metric.
#[cached(
time = 300,
convert = "{ cache_key(lat, lon, metric) }",

View File

@ -49,8 +49,11 @@ pub(crate) struct Item {
///
/// Returns [`None`] if retrieval or deserialization fails, or if the metric is not supported by
/// this provider.
///
/// If the result is [`Some`] it will be cached for 30 minutes for the the given position and
/// metric.
#[cached(
time = 300,
time = 1800,
convert = "{ cache_key(lat, lon, metric) }",
key = "(i32, i32, Metric)",
option = true