code: func (m *mruInventoryMap) Add(iv *wire.InvVect) {
  	m.invMtx.Lock()
  	defer m.invMtx.Unlock()
  
  	// When the limit is zero, nothing can be added to the map, so just
  	// return.
  	if m.limit == 0 {
  		return
  	}
  
  	// When the entry already exists move it to the front of the list
  	// thereby marking it most recently used.
  	if node, exists := m.invMap[*iv]; exists {
  		m.invList.MoveToFront(node)
  		return
  	}
  
  	// Evict the least recently used entry (back of the list) if the the new
  	// entry would exceed the size limit for the map.  Also reuse the list
  	// node so a new one doesn't have to be allocated.
  	if uint(len(m.invMap))+1 > m.limit {
  		node := m.invList.Back()
  		lru := node.Value.(*wire.InvVect)
  
  		// Evict least recently used item.
  		delete(m.invMap, *lru)
  
  		// Reuse the list node of the item that was just evicted for the
  		// new item.
  		node.Value = iv
  		m.invList.MoveToFront(node)
  		m.invMap[*iv] = node
  		return
  	}
  
  	// The limit hasn't been reached yet, so just add the new item.
  	node := m.invList.PushFront(iv)
  	m.invMap[*iv] = node
  }
docs: // Add adds the passed inventory to the map and handles eviction of the oldest
  // item if adding the new item would exceed the max limit.  Adding an existing
  // item makes it the most recently used item.
  //
  // This function is safe for concurrent access.