Caching - for comment
| Project: | Taxonomy image |
| Version: | 5.x-1.1 |
| Component: | Performance |
| Category: | feature request |
| Priority: | normal |
| Assigned: | NancyDru |
| Status: | closed |
While I was doing some performance work on the Glossary and Taxonomy List modules, I discovered that the Taxonomy Image calls were contributing a fair amount of time-to-render. The module does use static caching already and that wasn't helping nearly as much as I had hoped back when that was added.
As a test, I added Drupal caching (cache_xxx) and that made a noticeable improvement in the speed of things like Glossary and Taxonomy List. I haven't tested, but I would assume it would make a difference in any page that has several taxonomy images on it (regardless of how they are placed there). However, this improvement was only noticed when I created my own "cache_tax_image" table -- using one of the existing tables actually slowed it down.
Is anyone interested in having this added to the module as standard?

#1
Got a new addon for you. This makes faceted_search work with taxonomy_image
Simply put the following function in template.php
function YOURTHEME_faceted_search_ui_category($category, $path) {
// Note: get_label() is responsible for filtering its returned string.
if ($path) {
$label = l($category->get_label(TRUE), $path, array(), NULL, NULL, NULL, TRUE);
}
else {
$label = $category->get_label(TRUE);
}
if (function_exists (taxonomy_image_display)){
$label = taxonomy_image_display($category -> _tid) . $label;
}
return ''. $label .' ('. $category->get_count() .')';
}
The clever bit is the second to last line.
#2
Very interesting stuff. I would think this would be better placed in the Faceted Search module.
This thread was created to get some discussion on my possible addition of caching to the TI module.
#3
I would be interested! I think this would be a great addition to Taxonomy Image
#4
Here are patches for 5.x-1.2 and 6.x-1.2. Testing is strongly encouraged. Please provide feedback here.
#5
Committed to 5.x-1.x-dev release.
#6
Committed to 6.x-1.x-dev release.
Both versions need testing and comment.
#7
Nancy,
I am happy to help test it but I need to know what you are looking for. I have NOT used taxonomy image before, so I can't compare to previous versions. What sort of data do you need (other than, works-great or broke-my-whole-site!!!)?
Maria
#8
Thanks, Maria. Well, "works-great" or "broke-my-whole-site" is a good start. If you have Devel, you could also post some query times for the cache. I would be worried if you're seeing queries taking more than 0.5 milliseconds; I'd be thrilled if they are less that 0.25 ms.
#9
I do have devel, though I haven't gotten to the stage of actually noticing load times. It may take me a bit to get to this part of my site as I am still working through some upgrade issues, but I will let you know what I find when I get there.
#10
There will be no further official releases until there is adequate user testing and comment on this change.
#11
nancy, it's bugging out for me: first i got a blank white screen with this:
...taxonomy_image/contributed/taxonomy_image_node_display/taxonomy_image_node_display.module on line 17
then i reloaded afew times and got an error for each called image, like:
user warning: Table '{mydatabase}.cache_tax_image' doesn't exist query: SELECT data, created, headers, expire, serialized FROM cache_tax_image WHERE cid = 'taxonomy_image:52' in /.../html/includes/cache.inc on line 26. (but all different lines!)
#12
hmm, that's interesting - apparently i'm an idiot...forgot to run update.php - did so and saw confirmation of this:
taxonomy_image module
Update #6100
CREATE TABLE {cache_tax_image} ( `cid` VARCHAR(255) NOT NULL DEFAULT '', `data` LONGBLOB DEFAULT NULL, `expire` INT NOT NULL DEFAULT 0, `created` INT NOT NULL DEFAULT 0, `headers` TEXT DEFAULT NULL, `serialized` SMALLINT NOT NULL DEFAULT 0, PRIMARY KEY (cid), INDEX expire (expire) ) /*!40100 DEFAULT CHARACTER SET UTF8 */
...but i'm not seeing the images now! not sure what i did earlier, but perhaps that "files/" directory vanished in upgrade? or maybe i accidentally blasted it? where should files/ be located (i'm going to create a new directory for files/taximages to hold them but not sure if files should be autogenerated in a new location...
#13
at any rate, i went back in to teh site, uploaded a couple of taxonomy images and then checked via ftp to make sure they appeared in the right sites/default/files area (they were in there, saw them both) BUT they are not appearing on the site - i also flushed the cache via the admin page (performance) and checked again, and checked with a couple of themes...they just appear to be not displaying! no errors, nothing like that, just no visible taxonomy images in nodes or teasers (my settings allow for both)
#14
Based on your update number, I'm assuming you're on Drupal 6.x. Let's start with going to the administer >> settings >> performance and clearing all the caches (button near the bottom). Then, using PHPMyAdmin, or something like it clear (truncate) cache_tax_image as well.
#15
ah, didn't do the phpmyadmin - i'm not that savvy so try to stay away but can get to it via my control panel...and yes, i'm on d6.2 right now.
#16
Well, actually I found a way to make the Performance page do it, and it is now in the -dev version.
#17
cool - i'll pull that down tonight and try it out...
#18
Released some time ago.