forked from paul/sinoptik
Document caching; increase Luchtmeetnet caching to 30min
This commit is contained in:
parent
79981314d3
commit
0c5367f87f
|
@ -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);
|
||||
|
|
|
@ -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) }",
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue