Textpattern Caching

Posted:

IMHO, one of the biggest feature holes in Textpattern is its lack of caching. There are no built in mechanisms and the only option to date is the plugin zem_cache. I toyed around with it for a bit, but I don’t like having to wrap existing tags with more tags.

To fill the hole, I’ve made another mod to Textpattern v4.0.5. This one automatically adds caching support to all existing and future tags. In addition to output caching, the caching class can also be used by plugins to cache anything the developer needs. All cache entries are referenced by an id and a context. A context can be a page, a plugin name, a namespace, or anything else to guarantee an id is unique. The context makes caching tags uniquely between pages easy (e.g. the nav links on this site), and allows the caching of a tag across an entire site (e.g. the sidebar links).

I still need to make some additional improvements to the caching so that it works properly with the authentication mods currently in place. Caching what should be hidden information and displaying it to anonymous users is currently a very bad side effect. I think the solution will be as easy as appending $txp_user to the context.

This functionality does not exist in crockery and is a useful enough feature that I will probably submit a patch in to the void that is the txp-dev list.

blog comments powered by Disqus