func (c *Cache) add(name string, rrs rr.RRs) { newparts := rrs.Partition(true) if tidy(0, newparts) && len(newparts) == 0 { // nothing left to add return } now := time.Now().Unix() for _, part := range newparts { for _, rec := range part { rec.TTL = int32(now - secs0 + int64(rec.TTL)) } } c.rwm.Lock() // W++ defer c.rwm.Unlock() // W-- if oldparts, hit, _ := c.get0(name); hit { newparts.SetAdd(oldparts) } c.tree.Put(name, newparts.Join().Pack()) }