
Hi, I misread (or didn't read) the boost::multi_index_container documentation and assumed 'insert' on a unique index would do 'replace', but of course it doesn't and shouldn't. So, I've made this change: - s_negcache.insert(ne); + + pair<negcache_t::iterator, bool> res=s_negcache.insert(ne); + if(!res.second) { + s_negcache.erase(res.first); + s_negcache.insert(ne); + } But I can't help feeling there is probably a better and prettier way. Do people have any suggestions? In this case, ne is a NegCacheEntry, defined as: struct NegCacheEntry { string d_name; QType d_qtype; string d_qname; uint32_t d_ttd; }; And the index: typedef multi_index_container < NegCacheEntry, indexed_by < ordered_unique< composite_key< NegCacheEntry, member<NegCacheEntry, string, &NegCacheEntry::d_name>, member<NegCacheEntry, QType, &NegCacheEntry::d_qtype> >, composite_key_compare<CIStringCompare, std::less<QType> > >, ordered_non_unique< member<NegCacheEntry, uint32_t, &NegCacheEntry::d_ttd> >
negcache_t;
Thanks! -- http://www.PowerDNS.com Open source, database driven DNS Software http://netherlabs.nl Open and Closed source services