Skip to main content

HydraCacheEntity

Derive Macro HydraCacheEntity 

Source
#[derive(HydraCacheEntity)]
{
    // Attributes available to this derive:
    #[hydracache]
}
Expand description

Derive CacheEntity metadata for database result-cache helpers.

§Example

use hydracache_db::{CacheEntity, HydraCacheEntity};

#[derive(HydraCacheEntity)]
#[hydracache(entity = "user", collection = "users", id = i64)]
struct User {
    id: i64,
    name: String,
}

assert_eq!(User::cache_key_for(&42), "user:42");