category_node_get_categories_by_container() can be called several times per page load. On a current site, we get 150+ calls to this function on the Update/Insert of nodes.

Each time this function is called, it makes a separate, identical request the database. This patch adds static caching to the database query so duplicate queries are not executed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Version: 4.7.x-1.x-dev » master
FileSize
1.54 KB

Same patch for 5.0

JirkaRybka’s picture

Status: Needs review » Closed (won't fix)

The 5.x version is not supported anymore (unless someone volunteers), as stated by the maintainer.

In the 6.x-2.0-rc1 release, there's a different caching mechanism, that already adds both static AND database caching to ALL the expensive API functions (including the one mentioned here). See #501378: PERFORMANCE! Central caching for category API functions for details on that.