Trait wit_deps::Cache

source ·
pub trait Cache {
    type Read: AsyncBufRead + Unpin;
    type Write: AsyncWrite + Unpin;

    // Required methods
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        url: &'life1 Url,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Read>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn insert<'life0, 'life1, 'async_trait>(
        &'life0 self,
        url: &'life1 Url,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Write>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Resource caching layer

Required Associated Types§

source

type Read: AsyncBufRead + Unpin

Type returned by the Self::get method

source

type Write: AsyncWrite + Unpin

Type returned by the Self::insert method

Required Methods§

source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 Url, ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Read>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns an read handle for the entry from the cache associated with a given url

source

fn insert<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 Url, ) -> Pin<Box<dyn Future<Output = Result<Self::Write>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns a write handle for the entry associated with a given url

Implementors§

source§

impl Cache for Local

source§

impl<T: Cache + Sync + Send> Cache for Write<T>

§

type Read = <T as Cache>::Read

§

type Write = <T as Cache>::Write