code: func (m *txSortedMap) Cap(threshold int) types.Transactions {
  	// Short circuit if the number of items is under the limit
  	if len(m.items) <= threshold {
  		return nil
  	}
  	// Otherwise gather and drop the highest nonce'd transactions
  	var drops types.Transactions
  
  	sort.Sort(*m.index)
  	for size := len(m.items); size > threshold; size-- {
  		drops = append(drops, m.items[(*m.index)[size-1]])
  		delete(m.items, (*m.index)[size-1])
  	}
  	*m.index = (*m.index)[:threshold]
  	heap.Init(m.index)
  
  	// If we had a cache, shift the back
  	if m.cache != nil {
  		m.cache = m.cache[:len(m.cache)-len(drops)]
  	}
  	return drops
  }
docs: // Cap places a hard limit on the number of items, returning all transactions
  // exceeding that limit.