From 6c9ea9464077ce0454c5a5a2c0fb1f9f362e6825 Mon Sep 17 00:00:00 2001 From: Silvio Date: Tue, 19 Nov 2013 15:56:31 -0200 Subject: Implementing static cache at jquery_drawer_get_children() --- jquery_drawer.module | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jquery_drawer.module b/jquery_drawer.module index 7283fcd..682e506 100644 --- a/jquery_drawer.module +++ b/jquery_drawer.module @@ -147,6 +147,12 @@ function theme_jquery_drawer($menu) { * Render all nodes whose terms are children of $tid. */ function jquery_drawer_get_children($tid = NULL) { + static $cache = array(); + + if (isset($cache[$tid])) { + return $cache[$tid]; + } + $vid = variable_get('jquery_drawer', '1'); $terms = taxonomy_node_tree_taxonomy_get_tree($vid, $tid); @@ -168,8 +174,11 @@ function jquery_drawer_get_children($tid = NULL) { $nodes = db_query(db_rewrite_sql($query), implode(',', $filter)); $tree = taxonomy_node_tree_build($nodes, $terms); + $cache[$tid] = $tree; return $tree; } + + $cache[$tid] = NULL; } /** -- cgit v1.2.3