Friday, 27 September 2013

Drupal 7 - Getting already loaded nodes

Drupal 7 - Getting already loaded nodes

Is it possible to access already loaded nodes within a region template?
This is to prevent re-querying the same thing twice. I know that I can
load nodes with nid using node_load, which if the node is already loaded
it will retrieve the node from static cache. But for this case I don't
know the nid so I prefer getting a list of nids already loaded.
PS: Using PDO results are cached so there won't be much performance drop
even though I query the same thing several times but still I prefer
minimizing database contact as much as possible.

No comments:

Post a Comment