Trait deque_loader::LoadBy[][src]

pub trait LoadBy<T, K, V> where
    T: TaskHandler,
    K: Key,
    V: Send + Sync + Clone + 'static, 
{ type Error: Send + Sync + Clone + 'static; fn load_by<'async_trait>(
        key: K
    ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<V>>, Self::Error>> + Send + 'async_trait>>
    where
        Self: 'async_trait
;
fn cached_load_by<'async_trait, Cache: Send + AsRef<LoadCache<T>>>(
        key: K,
        cache: Cache
    ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<V>>, Self::Error>> + Send + 'async_trait>>
    where
        Cache: 'async_trait,
        Self: 'async_trait
; }
Expand description

Associated Types

Required methods

Load a value by it’s key in a batched load. If no TaskHandler is pending assignment, one will be scheduled. Even though this is scheduled up front, task assignment is deferred and will capture all loads that come thereafter; for a given request, it is guaranteed all loads will be enqueued before task assigment and batched optimally.

Load against a request contextual cache. Use register_cache_factory and crate::graphql::insert_loader_caches to hydrate Context<’_> and to define AsRef impl

Implementors