cache

WordPress nocache_headers() vs. Nginx

Typically, you can call WordPress’ nocache_headers() function when you don’t want content to be cached. Typically, but when you’re serving from behind Nginx as a reverse proxy, consideration must be paid.

It’s a year old now, so I shouldn’t have been surprised by it, but this thread on the Nginx forums explains that Cache-Control: private headers are meaningless when Nginx is being used as a reverse proxy:

nginx completely ignores the ‘private’ keyword and will cache your document regardless.

The recommendation is for the upstream app to send an X-Accel-Expires: 0 header.

The easy fix? Add a filter to nocache_headers() that inserts the additional header:

add_action( 'nocache_headers' , 'my_nocache_headers' , 1 );
function my_nocache_headers( $headers )
{
	$headers['X-Accel-Expires'] = 0;
	return $headers;
}

What is David McNicol’s URL Cache Plugin?

The description to David McNicol’s URL Cache Plugin raises more questions than it answers:

Given a URL, the url_cache() function will attempt to download the file it represents and return a URL pointing to this locally cached version.

Where did he plan to use it? Does he envision the cache as an archive, or for performance? Why hasn’t it been updated since 2005?

It caught my interest because I’ve long been interested in a solution to link rot in my blog. A real “perma-permalink” would be very useful.

Changes To WordPress Object Caching In 2.5

Jacob Santos‘ FuncDoc notes: The WordPress Object Cache changed in WordPress 2.5 and removed a lot of file support from the code. This means that the Object Cache in WordPress 2.5 is completely dependent on memory and will not be saved to disk for retrieval later. The constant WP_CACHE also changed its meaning. I’ve just […] » about 200 words

Introducing bsuite_speedcache

I wrote bsuite_speedcache to reduce the number of database queries I was executing per page load. By implementing it on some of the content in my sidebar, I dropped 35 queries for each cache hit. That might not seem like much, but it should average about 525 queries per minute that that my host server […] » about 300 words