code: func (c *Cache) Put(key interface{}, value cache.Value) (bool, error) {
  	vs, err := value.Size()
  	if err != nil {
  		return false, fmt.Errorf("couldn't determine size of cache "+
  			"value: %v", err)
  	}
  
  	if vs > c.capacity {
  		return false, fmt.Errorf("can't insert entry of size %v into "+
  			"cache with capacity %v", vs, c.capacity)
  	}
  
  	c.mtx.Lock()
  	defer c.mtx.Unlock()
  
  	// If the element already exists, remove it and decrease cache's size.
  	el, ok := c.cache[key]
  	if ok {
  		es, err := el.Value.(*entry).value.Size()
  		if err != nil {
  			return false, fmt.Errorf("couldn't determine size of "+
  				"existing cache value %v", err)
  		}
  		c.ll.Remove(el)
  		c.size -= es
  	}
  
  	// Then we need to make sure we have enough space for the element, evict
  	// elements if we need more space.
  	evicted, err := c.evict(vs)
  	if err != nil {
  		return false, err
  	}
  
  	// We have made enough space in the cache, so just insert it.
  	el = c.ll.PushFront(&entry{key, value})
  	c.cache[key] = el
  	c.size += vs
  
  	return evicted, nil
  }
docs: // Put inserts a given (key,value) pair into the cache, if the key already
  // exists, it will replace value and update it to be most recent item in cache.
  // The return value indicates whether items had to be evicted to make room for
  // the new element.