func (fc *FCache) insert(ent *Entry) *entry {
	// Pre-create the entry, if appropriate
	var newE *entry
	if ent.Error == nil || IsPermanent(ent.Error) {
		newE = &entry{
			content: ent,
		}
	}

	// Walk through the keys
	for _, k := range ent.Keys {
		// Skip indexes we don't know about
		idx, ok := fc.indexes[k.Index]
		if !ok {
			continue
		}

		// Complete the entry
		if e, ok := idx.entries[k.Key]; ok {
			if e.complete(ent) {
				delete(idx.entries, k.Key)
			}
		} else if newE != nil {
			idx.entries[k.Key] = newE
		}
	}

	return newE
}
// insert inserts the entry into the cache, constructing index entries
// as required.  The cache MUST be locked upon entry to this method.
insert inserts the entry into the cache, constructing index entries
as required.  The cache MUST be locked upon entry to this method.
// insert inserts the entry into the cache constructing index entries // as required . The cache MUST be locked upon entry to this method .
func (fc *FCache) insert(ent *Entry) *entry {
	var newE *entry
	if ent.Error == nil || IsPermanent(ent.Error) {
		newE = &entry{
			content: ent,
		}
	}
	for _, k := range ent.Keys {
		idx, ok := fc.indexes[k.Index]
		if !ok {
			continue
		}
		if e, ok := idx.entries[k.Key]; ok {
			if e.complete(ent) {
				delete(idx.entries, k.Key)
			}
		} else if newE != nil {
			idx.entries[k.Key] = newE
		}
	}
	return newE
}
func ( fc * FCache ) insert ( ent * Entry ) * entry { var newE * entry if ent . Error == nil || IsPermanent ( ent . Error ) { newE = & entry { content : ent , } } for _ , k := range ent . Keys { idx , ok := fc . indexes [ k . Index ] if ! ok { continue } if e , ok := idx . entries [ k . Key ] ; ok { if e . complete ( ent ) { delete ( idx . entries , k . Key ) } } else if newE != nil { idx . entries [ k . Key ] = newE } } return newE }
insert inserts the entry into the cache, constructing index entries
as required.
insert inserts the entry into the cache constructing index entries as required .
// Pre-create the entry, if appropriate // Walk through the keys // Skip indexes we don't know about // Complete the entry