pub trait Cache<C, T>: ReadonlyCache<C, T>where
C: Decoder + Encoder + Clone + Send + Sync,
T: Decode<<C as Decoder>::Codec> + Encode<<C as Encoder>::Codec> + Clone + Send + Sync,{
// Required methods
fn create_batch(&self) -> CacheBatch<C, T>;
fn create_batch_with_capacity(&self, capacity: usize) -> CacheBatch<C, T>;
fn insert_batch<'life0, 'async_trait>(
&'life0 self,
batch: CacheBatch<C, T>,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn insert<'life0, 'async_trait>(
&'life0 self,
value: T,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn unpin<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Cache trait.
Required Methods§
Sourcefn create_batch(&self) -> CacheBatch<C, T>
fn create_batch(&self) -> CacheBatch<C, T>
Creates a typed batch.
Sourcefn create_batch_with_capacity(&self, capacity: usize) -> CacheBatch<C, T>
fn create_batch_with_capacity(&self, capacity: usize) -> CacheBatch<C, T>
Creates a typed batch.
Sourcefn insert_batch<'life0, 'async_trait>(
&'life0 self,
batch: CacheBatch<C, T>,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn insert_batch<'life0, 'async_trait>(
&'life0 self,
batch: CacheBatch<C, T>,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Inserts a batch into the store.
Sourcefn insert<'life0, 'async_trait>(
&'life0 self,
value: T,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn insert<'life0, 'async_trait>(
&'life0 self,
value: T,
) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Encodes and inserts a block.