Incidental Imponderables #2

Why, when I put a clean shirt on just before sitting down for a meal, do I always seems to spill something on it?

AZIndex: Caching In — Update

AZIndex LogoJust a quick update for those who are following developments for my AZIndex plugin (is there anybody out there… there… there… ?).

Anyway, it looks like I have a viable caching solution almost completed, and the speed improvements are quite gratifying.  I have created several test indexes containing over 1100 items and the index pages load anywhere from 4x to 50x faster when they are being cached, depending on the options set for the index.

Obviously indexes with multiple pages see the biggest gains because if you put 1000 items on one index page, the plugin still has to loaded all 1000 items from the database even though they don’t have to be sorted.  Even so, a 4x speed improvement is nothing to sniff at.  But if you have a large number of items in the index, it’s only natural to have them spread over multiple pages, so in most cases you will see at least a 10x improvement over a non-cached index.

I have added an option to disable caching, but I recommend against using it unless you think you might be having problems with caching, and you can reset the cache from the admin page if necessary.

How does AZIndex know when the cache is out of date?  Well, it attaches to the WordPress action hooks which fire when someone saves or publishes a post.  Each index maintains a dirty list of posts and pages that have changed since the cache was last rebuilt, and when the index is next display, it checks though its dirty laundry (if you will) to see if the ordering of the items has been affected by the changes, or if a post needs to be removed from or added to the index.  If it does find the index needs to be updated, then it will rebuild the cache causing a one-time slower load for one very slightly unlucky user.

Hooking changes to custom fields turned out to be a pain, since there are no definitive hooks for them, and you can change them without having to save the post afterwards.  In the end I attach to the Ajax hooks which fire when a user is editing a custom field.  That will probably work for 99% of all custom field changes, but if a blog uses another plugin to change custom fields using the function calls, then there is little AZIndex can do to detected those changes.  But in the worst case, all the blogger has to do is manually clear the cache once all the changes have been made.

So, be on the lookout for AZIndex v0.5 with full caching support sometime this week, just in time for the holiday weekend.

Incidental Imponderables #1

Why, a full three decades after my first skin eruption, do I still get the same insane surge of pleasure when popping a ripe, bugling zit?

New Version of AZIndex Plugin in the Offing

AZIndex LogoI will be updating the AZIndex plugin to version 0.4 within a couple of days after I have done a bit more testing.  It contains just about all the new features I plan to add (except for caching) before I declare the beta phase over.  The new features include:

  • An option to use CSS style striping to decorate your index entries (e.g. add a gray background to alternate entries).
  • An option to use your own customized sort to sort an index.
  • An option to customize which alphabetical links appear with your index.
  • An option to place index entries that do not begin with a character or number at the end of the index instead of the beginning.
  • An option to ignore punctuation like quotes or double-quotes while sorting the index (useful if some of your post titles are in quotation marks, for example.
  • Safe upgrades to new versions without having to uninstall and recreate your indexes.

I think that’s more than enough functionality for the first major release of this plugin.  Thanks to everyone who has given me feedback, reported bugs, or suggested enhancements.  This plugin is already much the better for your help, even though it’s not quite finished yet.

I hope to have the caching done before I go on my summer vacation, but it could be tricky to do, so I can’t promise anything.  However, from playing with the plugin myself, and from feedback I have received from a couple of users, if you are holding off installing AZIndex because of my dire warnings about performance, it seems that I might have been a little too cautious.  If your index contains fewer than, say, a couple of hundred entries, and is not going to be accessed by thousands of users an hour, then I think you’ll find that it’s ok to install without the caching.

So keep your eyes peeled for an update to AZIndex.  It should be coming your way before the weekend is over.