]> git.meshlink.io Git - catta/blobdiff - cache.c
some more inomcplete work
[catta] / cache.c
diff --git a/cache.c b/cache.c
index 6a0a874da433fdb4ff43ad962606356141f743fe..9180570b9b63eac0d3fb2c9bdd60b3733d65b951 100644 (file)
--- a/cache.c
+++ b/cache.c
@@ -147,3 +147,26 @@ void flx_cache_drop_record(flxCache *c, flxRecord *r) {
     if ((e = flx_cache_lookup_record(c, r))) 
         remove_entry(c, e, TRUE);
 }
+
+static void func(gpointer key, gpointer data, gpointer userdata) {
+    flxCacheEntry *e = data;
+    flxKey *k = key;
+
+    gchar *s, *t;
+
+    s = flx_key_to_string(k);
+    t = flx_record_to_string(e->record);
+
+    fprintf((FILE*) userdata, "%s %s\n", s, t);
+    
+    g_free(s);
+    g_free(t);
+}
+
+void flx_cache_dump(flxCache *c, FILE *f) {
+    g_assert(c);
+    g_assert(f);
+
+    fprintf(f, ";;; CACHE DUMP FOLLOWS ;;;\n");
+    g_hash_table_foreach(c->hash_table, func, f);
+}