--- soup-cache.c.orig	2010-01-16 22:51:58.000000000 -0400
+++ soup-cache.c	2010-01-16 23:00:27.000000000 -0400
@@ -312,6 +312,9 @@
 	/* key & filename */
 	entry->key = soup_message_get_cache_key (msg);
 	md5 = g_compute_checksum_for_string (G_CHECKSUM_MD5, entry->key, -1);
+    /*FIXME: $cache_dir/file scheme can perform bad once directory will have 
+      a lot of files. Better stick with $cache_dir/fi/file scheme.
+      A subdir with first 2 chars of a filename */
 	entry->filename = g_build_filename (cache->priv->cache_dir, md5, NULL);
 	g_free (md5);
 
@@ -355,11 +358,10 @@
 }
 
 static void
-close_ready_cb (GObject *source, GAsyncResult *result, SoupCacheWritingFixture *fixture)
+close_ready_cb (GOutputStream *stream, GAsyncResult *result, SoupCacheWritingFixture *fixture)
 {
 	SoupCacheEntry *entry = fixture->entry;
 	SoupCache *cache = fixture->cache;
-	GOutputStream *stream = G_OUTPUT_STREAM (source);
 
 	g_warn_if_fail (entry->error || entry->pos == entry->length);
 
@@ -386,9 +388,8 @@
 }
 
 static void
-write_ready_cb (GObject *source, GAsyncResult *result, SoupCacheWritingFixture *fixture)
+write_ready_cb (GOutputStream *stream, GAsyncResult *result, SoupCacheWritingFixture *fixture)
 {
-	GOutputStream *stream = G_OUTPUT_STREAM (source);
 	GError *error = NULL;
 	gssize write_size;
 	SoupCacheEntry *entry = fixture->entry;
@@ -500,17 +501,14 @@
 static void
 soup_cache_entry_delete_by_key (SoupCache *cache, const char *key)
 {
-	GFile *file;
 	char *md5, *filename;
 
 	/* Delete cache file */
 	md5 = g_compute_checksum_for_string (G_CHECKSUM_MD5, key, -1);
 	filename = g_build_filename (cache->priv->cache_dir, md5, NULL);
-	file = g_file_new_for_path (filename);
-	g_file_delete (file, NULL, NULL);
+	g_unlink (filename);
 	g_free (md5);
 	g_free (filename);
-	g_object_unref (file);
 
 	/* Remove from cache */
 	g_hash_table_remove (cache->priv->cache, key);
@@ -524,9 +522,8 @@
 }
 
 static void
-append_to_ready_cb (GObject *source, GAsyncResult *result, SoupCacheWritingFixture *fixture)
+append_to_ready_cb (GFile *file, GAsyncResult *result, SoupCacheWritingFixture *fixture)
 {
-	GFile *file = (GFile*)source;
 	GError *error = NULL;
 	SoupCacheEntry *entry = fixture->entry;
 	GOutputStream *stream = (GOutputStream*)g_file_append_to_finish (file, result, &error);
@@ -610,9 +607,8 @@
 }
 
 static void
-load_contents_ready_cb (GObject *source, GAsyncResult *result, SoupMessage *msg)
+load_contents_ready_cb (GFile *file, GAsyncResult *result, SoupMessage *msg)
 {
-	GFile *file = (GFile*)source;
 	char *contents = NULL;
 	gsize length;
 	GError *error = NULL;
