pub struct BlockHeaderCache { /* private fields */ }Implementations§
Source§impl BlockHeaderCache
impl BlockHeaderCache
Sourcepub fn new(config: CacheConfig) -> Self
pub fn new(config: CacheConfig) -> Self
Create a new block header cache
Sourcepub async fn get_by_hash(&self, hash: &BlockHash) -> Option<BlockHeader>
pub async fn get_by_hash(&self, hash: &BlockHash) -> Option<BlockHeader>
Get a block header by hash
Sourcepub async fn get_by_height(&self, height: u64) -> Option<BlockHeader>
pub async fn get_by_height(&self, height: u64) -> Option<BlockHeader>
Get a block header by height
Sourcepub async fn insert(&self, header: BlockHeader)
pub async fn insert(&self, header: BlockHeader)
Insert a block header into cache
Sourcepub async fn invalidate(&self, hash: &BlockHash, height: u64)
pub async fn invalidate(&self, hash: &BlockHash, height: u64)
Invalidate a specific block header
Sourcepub async fn stats(&self) -> CacheStats
pub async fn stats(&self) -> CacheStats
Get cache statistics
Auto Trait Implementations§
impl Freeze for BlockHeaderCache
impl !RefUnwindSafe for BlockHeaderCache
impl Send for BlockHeaderCache
impl Sync for BlockHeaderCache
impl Unpin for BlockHeaderCache
impl !UnwindSafe for BlockHeaderCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more