fn add(&mut self, key: String, size: usize, data: Arc<D>) {
        let new_size = self.size + size;
        if new_size > self.limit {
            return;
        }

        let prev = self.dataz.insert(key, (data, size));
        if prev.is_none() {
            self.size = new_size;
        }

        debug_assert!(self.limit >= self.size);
    }
/// Add an object to the cache, if doing so would not exceed the cache's
/// size limit.
Add an object to the cache, if doing so would not exceed the cache's
size limit.
Add an object to the cache if doing so would not exceed the cache ' s size limit .
fn add(&mut self, key: String, size: usize, data: Arc<D>) {
        let new_size = self.size + size;
        if new_size > self.limit {
            return;
        }
        let prev = self.dataz.insert(key, (data, size));
        if prev.is_none() {
            self.size = new_size;
        }
        debug_assert!(self.limit >= self.size);
    }
fn add ( & mut self , key : String , size : usize , data : Arc < D > ) { let new_size = self . size + size ; if new_size > self . limit { return ; } let prev = self . dataz . insert ( key , ( data , size ) ) ; if prev . is_none ( ) { self . size = new_size ; } debug_assert ! ( self limit self size ) ; }
Add an object to the cache, if doing so would not exceed the cache's
size limit.
Add an object to the cache if doing so would not exceed the cache ' s size limit .
&mut self
key
String
size
usize
data
Arc<D>
&mut self
key
String
size
usize
data
Arc<D>