Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.158
diff -u -p -r1.158 module.inc
--- includes/module.inc	27 Sep 2009 11:08:45 -0000	1.158
+++ includes/module.inc	29 Sep 2009 14:43:23 -0000
@@ -421,7 +421,7 @@ function module_implements_write_cache()
   // cacheable for other reasons than the HTTP request type as well, but this
   // does not matter for the hook implementation cache, because nothing breaks
   // if hook implementations are not cached.
-  if (isset($implementations['#write_cache']) && drupal_page_is_cacheable()) {
+  if (isset($implementations['#write_cache']) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD')) {
     unset($implementations['#write_cache']);
     cache_set('module_implements', $implementations);
   }
Index: modules/simpletest/tests/module.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/module.test,v
retrieving revision 1.13
diff -u -p -r1.13 module.test
--- modules/simpletest/tests/module.test	24 Aug 2009 00:14:21 -0000	1.13
+++ modules/simpletest/tests/module.test	29 Sep 2009 14:43:34 -0000
@@ -81,6 +81,17 @@ class ModuleUnitTest extends DrupalWebTe
     ksort($expected_values);
     $this->assertIdentical($expected_values, module_list(FALSE, FALSE, TRUE), t('@condition: module_list() returns correctly sorted results', array('@condition' => $condition)));
   }
+
+  /**
+   * Test module_implements() caching.
+   */
+  function testModuleImplements() {
+    // Clear the cache.
+    cache_clear_all('module_implements');
+    $this->assertFalse(cache_get('module_implements'), t('The module implements cache is empty.'));
+    $this->drupalGet('');
+    $this->assertTrue(cache_get('module_implements'), t('The module implements cache is populated after requesting a page.'));
+  }
 }
 
 /**
