pub struct UtxoCache { /* private fields */ }Expand description
UTXO cache
Implementations§
Source§impl UtxoCache
impl UtxoCache
Sourcepub fn new(config: CacheConfig) -> Self
pub fn new(config: CacheConfig) -> Self
Create a new UTXO cache
Sourcepub async fn get(&self, address: &str) -> Option<Vec<Utxo>>
pub async fn get(&self, address: &str) -> Option<Vec<Utxo>>
Get UTXOs for an address from cache
Sourcepub async fn insert(&self, address: String, utxos: Vec<Utxo>)
pub async fn insert(&self, address: String, utxos: Vec<Utxo>)
Insert UTXOs for an address into cache
Sourcepub async fn invalidate(&self, address: &str)
pub async fn invalidate(&self, address: &str)
Invalidate UTXOs for a specific address
Sourcepub async fn invalidate_all(&self)
pub async fn invalidate_all(&self)
Invalidate all UTXOs (e.g., on new block)
Sourcepub async fn stats(&self) -> CacheStats
pub async fn stats(&self) -> CacheStats
Get cache statistics
Auto Trait Implementations§
impl Freeze for UtxoCache
impl !RefUnwindSafe for UtxoCache
impl Send for UtxoCache
impl Sync for UtxoCache
impl Unpin for UtxoCache
impl !UnwindSafe for UtxoCache
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