Serious performance issues - attempting to solve with caching. Patch attached.
themselves - October 14, 2009 - 07:25
| Project: | Advanced Taxonomy Blocks |
| Version: | 6.x-2.5 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
One of our clients has started using this module and has set up about 300 taxonomy terms with about 10 or so parents, and it results in about 2000 queries per page load, and slowed his site down to about 10 seconds per page.
To attempt to combat this, I've built a basic caching mechanism for the module. This could very clearly use some work, as it is completely non-configurable and may well be entirely broken in certain use cases, but it's a starting point at least.
504,511c504
< $term = (arg(0) == 'taxonomy' && arg(1) == 'term') ? arg(2) : 'root_taxonomyblocks_menu_cache';
< $cid = 'taxonomyblocks:' . $term;
< $content = cache_get($cid, 'cache');
< if (!$content) {
< $content = theme('multi_taxonomyblock', $item);
< cache_set($cid, $content, 'cache', CACHE_TEMPORARY);
< }
< $block['content'] = (is_object($content)) ? $content->data : $content;
---
> $block['content'] = theme('multi_taxonomyblock', $item);