pub fn insert(&mut self, key: &K, v: V) -> Arc<V> {
        match self.map.get_mut(key) {
            None | Some((0, _)) => Arc::new(v),
            Some((_, Some(val))) => val.clone(),
            Some((_, val @ None)) => {
                let v = Arc::new(v);
                *val = Some(v.clone());
                self.size += 1;
                v
            }
        }
    }
/// Insert a value into the cache. If the value is already present, an `Arc<V>` of the stored
/// value is returned. If the value is not stored but has been requested more than once, then
/// it is stored and returned. If the value is not stored and hasn't been requested more than
/// once, it is not stored and is simply returned, wrapped as an `Arc<V>`.
Insert a value into the cache. If the value is already present, an `Arc` of the stored
value is returned. If the value is not stored but has been requested more than once, then
it is stored and returned. If the value is not stored and hasn't been requested more than
once, it is not stored and is simply returned, wrapped as an `Arc`.
Insert a value into the cache . If the value is already present an ` Arc ` of the stored value is returned . If the value is not stored but has been requested more than once then it is stored and returned . If the value is not stored and hasn ' t been requested more than once it is not stored and is simply returned wrapped as an ` Arc ` .
pub fn insert(&mut self, key: &K, v: V) -> Arc<V> {
        match self.map.get_mut(key) {
            None | Some((0, _)) => Arc::new(v),
            Some((_, Some(val))) => val.clone(),
            Some((_, val @ None)) => {
                let v = Arc::new(v);
                *val = Some(v.clone());
                self.size += 1;
                v
            }
        }
    }
pub fn insert ( & mut self , key : & K , v : V ) -> Arc < V > { match self . map . get_mut ( key ) { None | Some ( ( 0 , _ ) ) => Arc :: new ( v ) , Some ( ( _ , Some ( val ) ) ) => val . clone ( ) , Some ( ( _ , val @ None ) ) => { let v = Arc :: new ( v ) ; * val = Some ( v . clone ( ) ) ; self . size += 1 ; v } } }
Insert a value into the cache.
Insert a value into the cache .
&mut self
key
&K
v
V