Hello all,
While learning about HTTP caching and the Conditional GET mechanism, I wrote this plugin for Zenphoto. Might it be useful for other people, and if so, should I upload it to Trac?
http://www.tummblr.com/my-code/zenphoto-plugin-http-cache-control/
[b]httpCacheControl[/b] is a plugin that makes your Zenphoto pages cacheable in order to increase site performance and minimize resource usage.
Making pages cacheable by browsers, proxies, HTTP accelerators can significantly increase your site’s performance and eliminate wastage of resources (CPU cycles, memory, bandwidth, time). While caching might be a complicated matter for sites with time-critical or user-sensitive information, it is a great performance-booster with hardly any side-effects for relatively static sites. Zenphoto is just one such application as it primarily serves static images.
Even if you cannot allow the possibility of visitors ever seeing stale content, this plugin can improve your site’s performance. httpCacheControl can make your pages cacheable but require that visitors revalidate their cache on every single visit. This plugin can determine if the requested page changed since the last visit using a fraction of the resources it would take to process, output, and transmit the entire page. Thus, within a few milliseconds, httpCacheControl can tell the visitor, “this page hasn’t changed since your last visit; use your cached copy,†or “this page has changed; I will now send you a fresh copy.â€
httpCacheControl is designed to be used in the album.php, albumarchive.php, image.php, index.php of your theme; in other words, the ZP_ALBUM, ZP_IMAGE, ZP_INDEX contexts.