Skip to main content

cached_impl

Attribute Macro cached_impl 

Source
#[cached_impl]
Expand description

Scope every #[cached] method of an impl block by its type.

Keeps same-named associated functions in one module from sharing cache keys. Scope every #[cached] method of an impl block by its type.

Adds scope = "<Type>" to each #[cached] method, so Products::get and Reviews::get in one module get different cache keys.

ⓘ
#[autumn_web::cached_impl]
impl Products {
    #[cached]
    async fn get(id: i64) -> String { /* .. */ }
}