+ if (unique) {
+
+ /* For unique records, remove all entries but one */
+ while (e->by_name_next)
+ remove_entry(c, e->by_name_next, TRUE);
+
+ } else {
+
+ /* For non-unique record, look for exactly the same entry */
+ for (; e; e = e->by_name_next)
+ if (flx_record_equal_no_ttl(e->record, r))
+ break;
+ }
+ }
+
+ if (e) {
+
+/* g_message("found matching cache entry"); */
+
+ /* We are the first in the linked list so let's replace the hash table key with the new one */
+ if (e->by_name_prev == NULL)
+ g_hash_table_replace(c->hash_table, r->key, e);
+
+ /* Notify subscribers */
+ if (!flx_record_equal_no_ttl(e->record, r))
+ flx_subscription_notify(c->server, c->interface, r, FLX_SUBSCRIPTION_CHANGE);
+
+ /* Update the record */
+ flx_record_unref(e->record);
+ e->record = flx_record_ref(r);
+
+ } else {
+ /* No entry found, therefore we create a new one */
+