Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1210
diff -u -p -r1.1210 common.inc
--- includes/common.inc	22 Aug 2010 12:46:21 -0000	1.1210
+++ includes/common.inc	2 Sep 2010 15:40:50 -0000
@@ -5277,7 +5277,7 @@ function show(&$element) {
  *   if no cached copy of the element is available.
  */
 function drupal_render_cache_get($elements) {
-  if (!in_array($_SERVER['REQUEST_METHOD'], array('GET', 'HEAD')) || !$cid = drupal_render_cid_create($elements)) {
+  if (!drupal_render_is_cacheable() || !in_array($_SERVER['REQUEST_METHOD'], array('GET', 'HEAD')) || !$cid = drupal_render_cid_create($elements)) {
     return FALSE;
   }
   $bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'cache';
@@ -5309,7 +5309,7 @@ function drupal_render_cache_get($elemen
  */
 function drupal_render_cache_set(&$markup, $elements) {
   // Create the cache ID for the element.
-  if (!in_array($_SERVER['REQUEST_METHOD'], array('GET', 'HEAD')) || !$cid = drupal_render_cid_create($elements)) {
+  if (!drupal_render_is_cacheable() || !in_array($_SERVER['REQUEST_METHOD'], array('GET', 'HEAD')) || !$cid = drupal_render_cid_create($elements)) {
     return FALSE;
   }
 
@@ -5330,6 +5330,25 @@ function drupal_render_cache_set(&$marku
 }
 
 /**
+ * Determine the cacheability of rendered content.
+ *
+ * @param $allow_caching
+ *   Set to FALSE if you want to prevent content rendered during the request
+ *   from being cached.
+ *
+ * @return
+ *   TRUE if rendered content can be cached, FALSE otherwise.
+ */
+function drupal_render_is_cacheable($allow_caching = NULL) {
+  $allow_caching_static = &drupal_static(__FUNCTION__, TRUE);
+  if (isset($allow_caching)) {
+    $allow_caching_static = $allow_caching;
+  }
+
+  return $allow_caching_static;
+}
+
+/**
  * Prepare an element for caching based on a query. This smart caching strategy
  * saves Drupal from querying and rendering to HTML when the underlying query is
  * unchanged.
@@ -5983,7 +6002,7 @@ function drupal_write_record($table, &$r
     }
 
     if (!property_exists($object, $field)) {
-      // Skip fields that are not provided, default values are already known 
+      // Skip fields that are not provided, default values are already known
       // by the database.
       continue;
     }
