![]() |
|
Plugin: HTTP Cache Control, improve performance & minimize resource usage - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Plugin: HTTP Cache Control, improve performance & minimize resource usage (/thread-1869.html) |
Plugin: HTTP Cache Control, improve performance & minimize resource usage - tummblr - 2007-11-29 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? [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. Plugin: HTTP Cache Control, improve performance & minimize resource usage - trisweb - 2007-11-29 Excellent, I'll have to try it out. I never did take a good look at ZP's HTTP headers for caching purposes... If we deem it useful for the Zenphoto core, would you be alright with us integrating your code? Since it's only HTTP header modification I think it's a useful core function. Plugin: HTTP Cache Control, improve performance & minimize resource usage - tummblr - 2007-11-29 I'd be honored to have this feature integrated in Zenphoto core. This is just a first stab at HTTP caching though. I'm not certain if my shortcut for verifying if a page has changed is 100% accurate, or if there are faster methods of verifying. Also, I haven't given any thought to caching that's compatible with comments and other social features since I haven't used those features yet. Plugin: HTTP Cache Control, improve performance & minimize resource usage - trisweb - 2007-11-30 I think your shortcut is sufficient. We can add a check for new comments, but that shouldn't be a common case when someone's browsing a gallery in sequence. Of course, if you set the cache-control correctly, the browser won't even bother checking, so it won't matter what you return. The conditional get is only when it goes back to ask, if it's own cache has been invalidated, afaik. Nice work! Plugin: HTTP Cache Control, improve performance & minimize resource usage - tummblr - 2007-12-01 I've updated the function to support comments. I'm using this query Known issue: Next step, make staticCacheControl comments-friendly. Plugin: HTTP Cache Control, improve performance & minimize resource usage - nothingless - 2009-01-28 I would love to use this plugin, but the link in the first post is dead. Does it still exist? Could anyone re-upload it so others can continue to use it? Or has it been integrated into ZenPhoto 1.2.2 by now? |