aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-11-19 15:56:31 -0200
committerSilvio <silvio@socioambiental.org>2013-11-19 15:56:31 -0200
commit6c9ea9464077ce0454c5a5a2c0fb1f9f362e6825 (patch)
tree6046f88173d3ce7119332996e8f45df3b609baae
parent7f98f5dca52386fec9c129071bb46591acb46da1 (diff)
downloadjquery_drawer-6c9ea9464077ce0454c5a5a2c0fb1f9f362e6825.tar.gz
jquery_drawer-6c9ea9464077ce0454c5a5a2c0fb1f9f362e6825.tar.bz2
Implementing static cache at jquery_drawer_get_children()
-rw-r--r--jquery_drawer.module9
1 files changed, 9 insertions, 0 deletions
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;
}
/**