I just confirmed that node_load() stores loaded nodes in a static variable. On Jan 15, 2009, at 4:53 PM, Anthony Wlodarski wrote:
I believe any further calls to node_load with the same node id are cached.
-Anthony -- Anthony Wlodarski www.thrillist.com <http://www.thrillist.com> Web Applications Developer 568 Broadway Ste. 605 New York, NY, 10012 (o) 646.786.1944
From: Ashraf Amayreh <mistknight@gmail.com> Reply-To: <development@drupal.org> Date: Thu, 15 Jan 2009 13:50:10 -0800 To: <development@drupal.org> Subject: [development] load node globally
Hello All,
Since I see so many node loads in block visibility and in modules that do $node manipulations and so forth, which would make me think that sometimes many node loads might occur on some pages and tens perhaps when you add contributed modules on that, I was wondering why not just load $node globally on node/<num>/* pages like we do with $user to avoid any extra node_loads? Developers would only need to global $node and it would either be null or populated and ready.
Before creating a patch for a *possibly* terrible idea, I thought I'd raise a stick and see if it gets shot :D
-- Ashraf Amayreh http://aamayreh.org