[][src]Trait substrate_client::blockchain::Cache

pub trait Cache<Block: BlockT>: Send + Sync {
    fn initialize(&self, key: &Id, value_at_genesis: Vec<u8>) -> Result<()>;
fn get_at(
        &self,
        key: &Id,
        block: &BlockId<Block>
    ) -> Option<((NumberFor<Block>, Block::Hash), Option<(NumberFor<Block>, Block::Hash)>, Vec<u8>)>; }

Blockchain optional data cache.

Required methods

fn initialize(&self, key: &Id, value_at_genesis: Vec<u8>) -> Result<()>

Initialize genesis value for the given cache.

The operation should be performed once before anything else is inserted in the cache. Otherwise cache may end up in inconsistent state.

fn get_at(
    &self,
    key: &Id,
    block: &BlockId<Block>
) -> Option<((NumberFor<Block>, Block::Hash), Option<(NumberFor<Block>, Block::Hash)>, Vec<u8>)>

Returns cached value by the given key.

Returned tuple is the range where value has been active and the value itself.

Loading content...

Implementors

Loading content...