--- apachesolr.module.orig	2009-12-22 15:17:00.000000000 +0100
+++ apachesolr.module	2009-12-22 15:10:28.000000000 +0100
@@ -1484,6 +1484,10 @@
 function apachesolr_cck_fields() {
   static $fields;
 
+  if ($cached = cache_get('apachesolr_cck_fields', 'cache_apachesolr')) {
+    $fields = &$cached->data;
+  }
+
   if (is_null($fields)) {
     $fields = array();
     // If CCK isn't enabled, do nothing.
@@ -1553,11 +1557,27 @@
         }
       }
     }
+
+    cache_set('apachesolr_cck_fields', $fields, 'cache_apachesolr');
   }
   return $fields;
 }
 
 /**
+ * Implementation of hook_content_fieldapi().
+ * Wipe the CCK fields mappings cache.
+ */
+function apachesolr_content_fieldapi($op, $field, $a3 = NULL, $a4 = NULL) {
+  switch ($op) {
+    case 'update instance':
+    case 'create instance':
+    case 'delete instance':
+      cache_clear_all('apachesolr_cck_fields', 'cache_apachesolr');
+      break;
+  }
+}
+
+/**
  * Use the content.module's content_format() to format the
  * field based on its value ($facet).
  *
