+ 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_key_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 */
+
+/* g_message("couldn't find matching cache entry"); */
+
+ e = g_new(flxCacheEntry, 1);
+ e->cache = c;
+ e->time_event = NULL;
+ e->record = flx_record_ref(r);
+
+ /* Append to hash table */
+ FLX_LLIST_PREPEND(flxCacheEntry, by_key, t, e);
+ g_hash_table_replace(c->hash_table, e->record->key, t);
+
+ /* Append to linked list */
+ FLX_LLIST_PREPEND(flxCacheEntry, entry, c->entries, e);
+
+ /* Notify subscribers */
+ flx_subscription_notify(c->server, c->interface, e->record, FLX_SUBSCRIPTION_NEW);
+ }
+
+ e->origin = *a;
+ g_get_current_time(&e->timestamp);
+ next_expiry(c, e, 80);
+ e->state = FLX_CACHE_VALID;
+ }
+}