headless_lms_server::controllers::main_frontend::courses::stats

Function cached_stats_query

Source
async fn cached_stats_query<F, Fut, T>(
    cache: &Cache,
    endpoint: &str,
    course_id: Uuid,
    extra_params: Option<&str>,
    duration: Duration,
    f: F,
) -> Result<T, ControllerError>
where F: FnOnce() -> Fut, Fut: Future<Output = Result<T, ModelError>>, T: Serialize + DeserializeOwned,
Expand description

Helper function to handle caching for stats endpoints