// Reallocate will avoid deleting all keys and reallocate a new
// map, this is useful if you believe you have a large map and
// will not need to grow back to a similar size.
2322
func (m *Map) Reallocate() {
	if m.initialSize > 0 {
		m.lookup = make(map[MapHash]MapEntry, m.initialSize)
	} else {
		m.lookup = make(map[MapHash]MapEntry)
	}
}
640945
func (s *MemoryStore) Put(key string, value interface{}) error {
	s.mu.Lock()
	defer s.mu.Unlock()
	if s.data == nil {
		s.data = map[string]string{}
	}

	buf, err := json.Marshal(value)
	if err != nil {
		return err
	}
	s.data[key] = string(buf)
	return nil
}
1120408
func (h *HashMap) Delete(k T) {
	hash := h.hash(k)
	var prev *hashEntry
	for entry := h.table[hash]; entry != nil; entry = entry.next {
		if h.eq(entry.k, k) {
			if prev != nil {
				prev.next = entry.next
			} else {
				h.table[hash] = entry.next
			}
			h.size--
			return
		}
		prev = entry
	}
}
976315
func Initialize(xu *xgbutil.XUtil) {
	// Listen to mapping notify events
	xevent.MappingNotifyFun(updateMaps).Connect(xu, xevent.NoWindow)

	// Give us an initial mapping state...
	keyMap, modMap := MapsGet(xu)
	KeyMapSet(xu, keyMap)
	ModMapSet(xu, modMap)
}
707694
func (m *Map) Store(key, value interface{}) {
	if m.m == nil {
		m.m = make(map[interface{}]interface{})
	}
	m.m[key] = value
}
498296
func (b *BiMap) Delete(k interface{}) {
	b.s.RLock()
	if b.immutable {
		panic("Cannot modify immutable map")
	}
	b.s.RUnlock()

	if !b.Exists(k) {
		return
	}
	val, _ := b.Get(k)
	b.s.Lock()
	defer b.s.Unlock()
	delete(b.forward, k)
	delete(b.inverse, val)
}
871362
func (m *Map) Reset() {
	for hash, entry := range m.lookup {
		m.removeMapKey(hash, entry.key)
	}
}
665415
func Expand(m map[string]string, key string) interface{} {
	// If the key is exactly a key in the map, just return it
	if v, ok := m[key]; ok {
		if v == "true" {
			return true
		} else if v == "false" {
			return false
		}

		return v
	}

	// Check if the key is an array, and if so, expand the array
	if v, ok := m[key+".#"]; ok {
		// If the count of the key is unknown, then just put the unknown
		// value in the value itself. This will be detected by Terraform
		// core later.
		if v == hil.UnknownValue {
			return v
		}

		return expandArray(m, key)
	}

	// Check if this is a prefix in the map
	prefix := key + "."
	for k := range m {
		if strings.HasPrefix(k, prefix) {
			return expandMap(m, prefix)
		}
	}

	return nil
}
883009
func (h *HashMap) Copy() *HashMap {
	cpy := NewHashMap(h.eq, h.hash)
	h.Iter(func(k, v T) bool {
		cpy.Put(k, v)
		return false
	})
	return cpy
}
843806
func (c *Config) Put(key string, value interface{}) (changed bool) {
	return c.PutKey(c.NewKey(key), value)
}
579906
func (m Map) Keys() []string {
	ks := make(map[string]struct{})
	for k, _ := range m {
		idx := strings.Index(k, ".")
		if idx == -1 {
			idx = len(k)
		}

		ks[k[:idx]] = struct{}{}
	}

	result := make([]string, 0, len(ks))
	for k, _ := range ks {
		result = append(result, k)
	}

	return result
}
804058
func (k *KeyValueStringSlice) Map() map[string]string {
	result := make(map[string]string, len(k.Keys))
	for i, key := range k.Keys {
		result[key] = k.Values[i]
	}
	return result
}
581982
func (r *Redis) Delete(key string) error {
	return r.Client.Del(key).Err()
}
424077
func (m *MultiMap) Put(key interface{}, value interface{}) {
	m.m[key] = append(m.m[key], value)
}
604548
func (mem *Memcache) Delete(key string) error {
	return mem.conn.Delete(key)
}
764889
func (h *HashMap) Put(k T, v T) {
	hash := h.hash(k)
	head := h.table[hash]
	for entry := head; entry != nil; entry = entry.next {
		if h.eq(entry.k, k) {
			entry.v = v
			return
		}
	}
	h.table[hash] = &hashEntry{k: k, v: v, next: head}
	h.size++
}
1178111
func (c *BufferLRU) Put(key int64, slice []byte) {
	c.mut.Lock()
	defer c.mut.Unlock()

	if c.cache == nil {
		c.actualSize = 0
		c.cache = make(map[int64]*list.Element, 1000)
		c.ll = list.New()
	}

	bufSize := FileSize(len(slice))
	if ee, ok := c.cache[key]; ok {
		oldBuf := ee.Value.(buffer)
		// in this case bufSize is a delta: new size - old size
		bufSize -= FileSize(len(oldBuf.Slice))
		c.ll.MoveToFront(ee)
		ee.Value = buffer{key, slice}
	} else {
		if bufSize > c.MaxSize {
			return
		}
		ee := c.ll.PushFront(buffer{key, slice})
		c.cache[key] = ee
	}

	c.actualSize += bufSize
	for c.actualSize > c.MaxSize {
		last := c.ll.Back()
		lastObj := last.Value.(buffer)
		lastSize := FileSize(len(lastObj.Slice))

		c.ll.Remove(last)
		delete(c.cache, lastObj.Key)
		c.actualSize -= lastSize
	}
}