Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.774 diff -u -r1.774 node.module --- modules/node/node.module 11 Jan 2007 08:51:31 -0000 1.774 +++ modules/node/node.module 12 Jan 2007 22:59:32 -0000 @@ -484,17 +484,28 @@ * A fully-populated node object. */ function node_load($param = array(), $revision = NULL, $reset = NULL) { + global $user; static $nodes = array(); if ($reset) { + foreach ($nodes as $node) { + dmemcache_delete($node->nid, 'node'); + } $nodes = array(); } $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]; + } + $cached_node = dmemcache_get($param, 'node'); + if ($cached_node && $cached_node->nid) { + $nodes[$param] = is_object($cached_node) ? drupal_clone($cached_node) : $cached_node; + return $nodes[$param]; + } } $cond = 'n.nid = %d'; $arguments[] = $param; @@ -532,8 +543,12 @@ $node->$key = $value; } } + if ($cachable) { $nodes[$node->nid] = is_object($node) ? drupal_clone($node) : $node; + if (is_numeric($param) && count($user->roles) === 1 && in_array('authenticated user', $user->roles)) { + dmemcache_set($param, $nodes[$node->nid], 0, 'node'); + } } }