BUG/MEDIUM: cache: free callback to remove from tree

Call the shctx free_blocks callback in order to remove the row from the
cache tree.

Put the row in the hot list during allocation, forbid the blocks to be
stolen by a free or a row_reserve
diff --git a/src/cache.c b/src/cache.c
index 9272a6f..8dd4606 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -338,6 +338,14 @@
 }
 
 
+static void cache_free_blocks(struct shared_block *first, struct shared_block *block)
+{
+	if (first == block) {
+		struct cache_entry *object = (struct cache_entry *)first->data;
+		eb32_delete(&object->eb);
+	}
+}
+
 /*
  * This fonction will store the headers of the response in a buffer and then
  * register a filter to store the data
@@ -575,10 +583,12 @@
 	struct cache *cache = (struct cache *)rule->arg.act.p[0];
 
 	search_entry.eb.key = hash_djb2(s->txn->uri, strlen(s->txn->uri));
+	shctx_lock(shctx_ptr(cache));
 	res = entry_exist(cache, &search_entry);
 	if (res) {
 		struct appctx *appctx;
-
+		shctx_row_inc_hot(shctx_ptr(cache), block_ptr(res));
+		shctx_unlock(shctx_ptr(cache));
 		s->target = &http_cache_applet.obj_type;
 		if ((appctx = stream_int_register_handler(&s->si[1], objt_applet(s->target)))) {
 			appctx->st0 = HTTP_CACHE_INIT;
@@ -589,6 +599,7 @@
 			return ACT_RET_YIELD;
 		}
 	}
+	shctx_unlock(shctx_ptr(cache));
 	return ACT_RET_CONT;
 }
 
@@ -705,7 +716,7 @@
 			err_code |= ERR_FATAL | ERR_ALERT;
 			goto out;
 		}
-
+		shctx->free_block = cache_free_blocks;
 		memcpy(shctx->data, tmp_cache_config, sizeof(struct cache));
 		cache = (struct cache *)shctx->data;
 		cache->entries = EB_ROOT_UNIQUE;