=== modified file 'modules/comment/comment.module'
--- modules/comment/comment.module	2007-06-24 10:09:50 +0000
+++ modules/comment/comment.module	2007-06-27 09:50:32 +0000
@@ -742,8 +742,6 @@ function comment_save($edit) {
         // Update the comment in the database.
         db_query("UPDATE {comments} SET status = %d, timestamp = %d, subject = '%s', comment = '%s', format = %d, uid = %d, name = '%s', mail = '%s', homepage = '%s' WHERE cid = %d", $edit['status'], $edit['timestamp'], $edit['subject'], $edit['comment'], $edit['format'], $edit['uid'], $edit['name'], $edit['mail'], $edit['homepage'], $edit['cid']);
 
-        _comment_update_node_statistics($edit['nid']);
-
         // Allow modules to respond to the updating of a comment.
         comment_invoke_comment($edit, 'update');
 
@@ -816,14 +814,13 @@ function comment_save($edit) {
         db_query("INSERT INTO {comments} (nid, pid, uid, subject, comment, format, hostname, timestamp, status, score, users, thread, name, mail, homepage) VALUES (%d, %d, %d, '%s', '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s')", $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], ip_address(), $edit['timestamp'], $status, $score, $users, $thread, $edit['name'], $edit['mail'], $edit['homepage']);
         $edit['cid'] = db_last_insert_id('comments', 'cid');
 
-        _comment_update_node_statistics($edit['nid']);
-
         // Tell the other modules a new comment has been submitted.
         comment_invoke_comment($edit, 'insert');
 
         // Add an entry to the watchdog log.
         watchdog('content', 'Comment: added %subject.', array('%subject' => $edit['subject']), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], array('fragment' => 'comment-'. $edit['cid'])));
       }
+      _comment_update_node_statistics($edit['nid']);
 
       // Clear the cache so an anonymous user can see his comment being added.
       cache_clear_all();
@@ -2033,6 +2030,7 @@ function _comment_update_node_statistics
     $node = db_fetch_object(db_query("SELECT uid, created FROM {node} WHERE nid = %d", $nid));
     db_query("UPDATE {node_comment_statistics} SET comment_count = 0, last_comment_timestamp = %d, last_comment_name = '', last_comment_uid = %d WHERE nid = %d", $node->created, $node->uid, $nid);
   }
+  cache_clear_all($nid, 'cache_node');
 }
 
 /**

=== modified file 'modules/node/node.module'
--- modules/node/node.module	2007-06-24 10:09:50 +0000
+++ modules/node/node.module	2007-06-27 09:46:25 +0000
@@ -394,6 +394,7 @@ function node_type_delete($type) {
  */
 function node_type_update_nodes($old_type, $type) {
   db_query("UPDATE {node} SET type = '%s' WHERE type = '%s'", $type, $old_type);
+  cache_clear_all('*', 'cache_node');
   return db_affected_rows();
 }
 
@@ -562,8 +563,14 @@ function node_load($param = array(), $re
   $cachable = ($revision == NULL);
   $arguments = array();
   if (is_numeric($param)) {
-    if ($cachable && isset($nodes[$param])) {
-      return is_object($nodes[$param]) ? drupal_clone($nodes[$param]) : $nodes[$param];
+    if ($cachable)
+      if (isset($nodes[$param])) {
+        return is_object($nodes[$param]) ? drupal_clone($nodes[$param]) : $nodes[$param];
+      }
+      if ($cache = cache_get($param, 'cache_node')) {
+        $nodes[$param] = $cache->data;
+        return is_object($nodes[$param]) ? drupal_clone($nodes[$param]) : $nodes[$param];
+      }
     }
     $cond = 'n.nid = %d';
     $arguments[] = $param;
@@ -606,6 +613,7 @@ function node_load($param = array(), $re
     }
     if ($cachable) {
       $nodes[$node->nid] = is_object($node) ? drupal_clone($node) : $node;
+      cache_set($param, $nodes[$node->nid], 'cache_node');
     }
   }
 
@@ -721,6 +729,8 @@ function node_save(&$node) {
 
   // Clear the cache so an anonymous poster can see the node being added or updated.
   cache_clear_all();
+  // Clear the node load cache for this node.
+  cache_clear_all($node->nid, 'cache_node');
 }
 
 /**
@@ -1011,6 +1021,7 @@ function node_user($op, &$edit, &$user) 
   if ($op == 'delete') {
     db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $user->uid);
     db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $user->uid);
+    cache_clear_all('*', 'cache_node');
   }
 }
 
@@ -1582,6 +1593,7 @@ function node_admin_nodes_submit($form, 
     call_user_func_array($function, $args);
 
     cache_clear_all();
+    cache_clear_all('*', 'cache_node');
     drupal_set_message(t('The update has been performed.'));
   }
 }

=== modified file 'modules/node/node.schema'
--- modules/node/node.schema	2007-06-15 18:40:14 +0000
+++ modules/node/node.schema	2007-06-27 09:31:08 +0000
@@ -105,6 +105,8 @@ function node_schema() {
     ),
     'primary key' => array('type'),
   );
+  $schema['cache_node'] = drupal_get_schema_unprocessed('system', 'cache');
+
 
   return $schema;
 }

=== modified file 'modules/poll/poll.module'
--- modules/poll/poll.module	2007-06-22 05:44:20 +0000
+++ modules/poll/poll.module	2007-06-27 09:51:29 +0000
@@ -299,24 +299,6 @@ function poll_load($node) {
   while ($choice = db_fetch_array($result)) {
     $poll->choice[$choice['chorder']] = $choice;
   }
-
-  // Determine whether or not this user is allowed to vote
-  $poll->allowvotes = FALSE;
-  if (user_access('vote on polls') && $poll->active) {
-    if ($user->uid) {
-      $result = db_fetch_object(db_query('SELECT chorder FROM {poll_votes} WHERE nid = %d AND uid = %d', $node->nid, $user->uid));
-    }
-    else {
-      $result = db_fetch_object(db_query("SELECT chorder FROM {poll_votes} WHERE nid = %d AND hostname = '%s'", $node->nid, ip_address()));
-    }
-    if (isset($result->chorder)) {
-      $poll->vote = $result->chorder;
-    }
-    else {
-      $poll->vote = -1;
-      $poll->allowvotes = TRUE;
-    }
-  }
   return $poll;
 }
 
@@ -602,6 +584,25 @@ function poll_view($node, $teaser = FALS
   global $user;
   $output = '';
 
+  // Determine whether or not this user is allowed to vote
+  $poll->allowvotes = FALSE;
+  if (user_access('vote on polls') && $poll->active) {
+    if ($user->uid) {
+      $result = db_fetch_object(db_query('SELECT chorder FROM {poll_votes} WHERE nid = %d AND uid = %d', $node->nid, $user->uid));
+    }
+    else {
+      $result = db_fetch_object(db_query("SELECT chorder FROM {poll_votes} WHERE nid = %d AND hostname = '%s'", $node->nid, ip_address()));
+    }
+    if (isset($result->chorder)) {
+      $poll->vote = $result->chorder;
+    }
+    else {
+      $poll->vote = -1;
+      $poll->allowvotes = TRUE;
+    }
+  }
+
+
   // Special display for side-block
   if ($block) {
     // No 'read more' link

=== modified file 'modules/system/system.install'
--- modules/system/system.install	2007-06-23 11:15:15 +0000
+++ modules/system/system.install	2007-06-27 09:32:20 +0000
@@ -3362,6 +3362,43 @@ function system_update_6024() {
 }
 
 /**
+ * Add the node load cache table.
+ */
+function system_update_6025() {
+  $ret = array();
+
+  switch ($GLOBALS['db_type']) {
+    case 'pgsql':
+      $ret[] = update_sql("CREATE TABLE {cache_node} (
+        cid varchar(255) NOT NULL default '',
+        data bytea,
+        expire int NOT NULL default '0',
+        created int NOT NULL default '0',
+        headers text,
+        serialized smallint NOT NULL default '0',
+        PRIMARY KEY (cid)
+    )");
+      $ret[] = update_sql("CREATE INDEX {cache_node}_expire_idx ON {cache_form} (expire)");
+      break;
+    case 'mysql':
+    case 'mysqli':
+      $ret[] = update_sql("CREATE TABLE {cache_node} (
+        cid varchar(255) NOT NULL default '',
+        data longblob,
+        expire int NOT NULL default '0',
+        created int NOT NULL default '0',
+        headers text,
+        serialized int(1) NOT NULL default '0',
+        PRIMARY KEY (cid),
+        INDEX expire (expire)
+      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
+      break;
+  }
+
+  return $ret;
+}
+
+/**
  * @} End of "defgroup updates-5.x-to-6.x"
  * The next series of updates should start at 7000.
  */

=== modified file 'modules/translation/translation.module'
--- modules/translation/translation.module	2007-06-15 18:40:14 +0000
+++ modules/translation/translation.module	2007-06-27 09:44:57 +0000
@@ -296,6 +296,8 @@ function translation_remove_from_set($no
         db_query('UPDATE {node} SET tnid = %d WHERE tnid = %d', $new_tnid, $node->tnid);
       }
     }
+    // TODO: finer grain deletion.
+    cache_clear_all('*', 'cache_node');
   }
 }
 

=== modified file 'modules/user/user.module'
--- modules/user/user.module	2007-06-24 10:09:50 +0000
+++ modules/user/user.module	2007-06-27 09:38:11 +0000
@@ -522,13 +522,13 @@ function user_search($op = 'search', $ke
           // Administrators can also search in the otherwise private email field.
           $result = pager_query("SELECT name, uid, mail FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%') OR LOWER(mail) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys, $keys);
           while ($account = db_fetch_object($result)) {
-            $find[] = array('title' => $account->name .' ('. $account->mail .')', 'link' => url('user/'. $account->uid, array('absolute' => TRUE)));  
+            $find[] = array('title' => $account->name .' ('. $account->mail .')', 'link' => url('user/'. $account->uid, array('absolute' => TRUE)));
           }
         }
         else {
-          $result = pager_query("SELECT name, uid FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys); 
+          $result = pager_query("SELECT name, uid FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", 15, 0, NULL, $keys);
           while ($account = db_fetch_object($result)) {
-            $find[] = array('title' => $account->name, 'link' => url('user/'. $account->uid, array('absolute' => TRUE)));  
+            $find[] = array('title' => $account->name, 'link' => url('user/'. $account->uid, array('absolute' => TRUE)));
           }
         }
         return $find;
@@ -1650,6 +1650,7 @@ function user_delete($edit, $uid) {
   watchdog('user', 'Deleted user: %name %email.', $variables, WATCHDOG_NOTICE);
   drupal_set_message(t('%name has been deleted.', $variables));
   module_invoke_all('user', 'delete', $edit, $account);
+  cache_clear_all();
 }
 
 function user_edit_validate($form, &$form_state) {

