pub(crate) struct ReadOnlyAccountsCache {
cache: DashMap<(Pubkey, Slot), ReadOnlyAccountCacheEntry>,
queue: Mutex<IndexList<(Pubkey, Slot)>>,
max_data_size: usize,
data_size: AtomicUsize,
hits: AtomicU64,
misses: AtomicU64,
evicts: AtomicU64,
}
Fields§
§cache: DashMap<(Pubkey, Slot), ReadOnlyAccountCacheEntry>
§queue: Mutex<IndexList<(Pubkey, Slot)>>
§max_data_size: usize
§data_size: AtomicUsize
§hits: AtomicU64
§misses: AtomicU64
§evicts: AtomicU64
Implementations§
source§impl ReadOnlyAccountsCache
impl ReadOnlyAccountsCache
pub(crate) fn new(max_data_size: usize) -> Self
sourcepub fn reset_for_tests(&self)
pub fn reset_for_tests(&self)
reset the read only accounts cache useful for benches/tests
pub(crate) fn load( &self, pubkey: Pubkey, slot: Slot ) -> Option<AccountSharedData>
fn account_size(&self, account: &AccountSharedData) -> usize
pub(crate) fn store( &self, pubkey: Pubkey, slot: Slot, account: AccountSharedData )
pub(crate) fn remove( &self, pubkey: Pubkey, slot: Slot ) -> Option<AccountSharedData>
pub(crate) fn cache_len(&self) -> usize
pub(crate) fn data_size(&self) -> usize
pub(crate) fn get_and_reset_stats(&self) -> (u64, u64, u64)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ReadOnlyAccountsCache
impl Send for ReadOnlyAccountsCache
impl Sync for ReadOnlyAccountsCache
impl Unpin for ReadOnlyAccountsCache
impl UnwindSafe for ReadOnlyAccountsCache
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