code: func (c *Cache) evict(needed uint64) (bool, error) {
  	if needed > c.capacity {
  		return false, fmt.Errorf("can't evict %v elements in size, "+
  			"since capacity is %v", needed, c.capacity)
  	}
  
  	evicted := false
  	for c.capacity-c.size < needed {
  		// We still need to evict some more elements.
  		if c.ll.Len() == 0 {
  			// We should never reach here.
  			return false, fmt.Errorf("all elements got evicted, "+
  				"yet still need to evict %v, likelihood of "+
  				"error during size calculation",
  				needed-(c.capacity-c.size))
  		}
  
  		// Find the least recently used item.
  		if elr := c.ll.Back(); elr != nil {
  			// Determine lru item's size.
  			ce := elr.Value.(*entry)
  			es, err := ce.value.Size()
  			if err != nil {
  				return false, fmt.Errorf("couldn't determine "+
  					"size of existing cache value %v", err)
  			}
  
  			// Account for that element's removal in evicted and
  			// cache size.
  			c.size -= es
  
  			// Remove the element from the cache.
  			c.ll.Remove(elr)
  			delete(c.cache, ce.key)
  			evicted = true
  		}
  	}
  
  	return evicted, nil
  }
docs: // evict will evict as many elements as necessary to make enough space for a new
  // element with size needed to be inserted.