Query

Trait Query 

Source
pub trait Query {
    type CacheKey: Key;
    type Output;

    // Required methods
    fn cache_key(&self) -> Self::CacheKey;
    fn query(&self, ctx: &mut QueryContext) -> Result<Self::Output, Error>;

    // Provided method
    fn never_cache(&self) -> bool { ... }
}

Required Associated Types§

Required Methods§

Source

fn cache_key(&self) -> Self::CacheKey

Get the cache key for the query.

Source

fn query(&self, ctx: &mut QueryContext) -> Result<Self::Output, Error>

Query the output of the query.

Provided Methods§

Source

fn never_cache(&self) -> bool

Whether the query should never be cached.

If true, this query will always be re-calculated. Even if not cached, downstream queries can be cached.

Implementors§