fn should_remove_from_mem(
        &self,
        current_age: Age,
        entry: &AccountMapEntry<T>,
        startup: bool,
        update_stats: bool,
        exceeds_budget: bool,
    ) -> bool {
        // this could be tunable dynamically based on memory pressure
        // we could look at more ages or we could throw out more items we are choosing to keep in the cache
        if startup || (current_age == entry.age()) {
            if exceeds_budget {
                // if we are already holding too many items in-mem, then we need to be more aggressive at kicking things out
                true
            } else {
                // only read the slot list if we are planning to throw the item out
                let slot_list = entry.slot_list.read().unwrap();
                if slot_list.len() != 1 {
                    if update_stats {
                        Self::update_stat(&self.stats().held_in_mem_slot_list_len, 1);
                    }
                    false // keep 0 and > 1 slot lists in mem. They will be cleaned or shrunk soon.
                } else {
                    // keep items with slot lists that contained cached items
                    let remove = !slot_list.iter().any(|(_, info)| info.is_cached());
                    if !remove && update_stats {
                        Self::update_stat(&self.stats().held_in_mem_slot_list_cached, 1);
                    }
                    remove
                }
            }
        } else {
            false
        }
    }
/// return true if 'entry' should be removed from the in-mem index
return true if 'entry' should be removed from the in-mem index
return true if ' entry ' should be removed from the in - mem index
fn should_remove_from_mem(
        &self,
        current_age: Age,
        entry: &AccountMapEntry<T>,
        startup: bool,
        update_stats: bool,
        exceeds_budget: bool,
    ) -> bool {
        // this could be tunable dynamically based on memory pressure
        // we could look at more ages or we could throw out more items we are choosing to keep in the cache
        if startup || (current_age == entry.age()) {
            if exceeds_budget {
                // if we are already holding too many items in-mem, then we need to be more aggressive at kicking things out
                true
            } else {
                // only read the slot list if we are planning to throw the item out
                let slot_list = entry.slot_list.read().unwrap();
                if slot_list.len() != 1 {
                    if update_stats {
                        Self::update_stat(&self.stats().held_in_mem_slot_list_len, 1);
                    }
                    false // keep 0 and > 1 slot lists in mem. They will be cleaned or shrunk soon.
                } else {
                    // keep items with slot lists that contained cached items
                    let remove = !slot_list.iter().any(|(_, info)| info.is_cached());
                    if !remove && update_stats {
                        Self::update_stat(&self.stats().held_in_mem_slot_list_cached, 1);
                    }
                    remove
                }
            }
        } else {
            false
        }
    }
fn should_remove_from_mem ( & self , current_age : Age , entry : & AccountMapEntry < T > , startup : bool , update_stats : bool , exceeds_budget : bool , ) -> bool { // this could be tunable dynamically based on memory pressure // we could look at more ages or we could throw out more items we are choosing to keep in the cache if startup || ( current_age == entry . age ( ) ) { if exceeds_budget { // if we are already holding too many items in-mem, then we need to be more aggressive at kicking things out true } else { // only read the slot list if we are planning to throw the item out let slot_list = entry . slot_list . read ( ) . unwrap ( ) ; if slot_list . len ( ) != 1 { if update_stats { Self :: update_stat ( & self . stats ( ) . held_in_mem_slot_list_len , 1 ) ; } false // keep 0 and > 1 slot lists in mem. They will be cleaned or shrunk soon. } else { // keep items with slot lists that contained cached items let remove = ! slot_list . iter ( ) . any ( | ( _ , info ) | info . is_cached ( ) ) ; if ! remove && update_stats { Self :: update_stat ( & self . stats ( ) . held_in_mem_slot_list_cached , 1 ) ; } remove } } } else { false } }
return true if 'entry' should be removed from the in-mem index
return true if ' entry ' should be removed from the in - mem index
&self
current_age
Age
entry
&AccountMapEntry<T>
startup
bool
update_stats
bool
exceeds_budget
bool