[Melbourne-pm] Apache Cache

Scott Penrose scottp at dd.com.au
Mon Jul 3 21:46:01 PDT 2006

What you wrote about Caching 101 and 102 is good, but I think we are  
aware of it, all of those issues you mentioned have been explicitly  
mentioned in this thread :-) But valuable none the less.

On 04/07/2006, at 14:03, Mathew Robertson wrote:
> As to the origonal problem -> we want thumbnails, thus caching was
> suggested.  Why caching?   What is the problem that we are trying to
> solve?  To generate smaller images automatically?

The original problem - YES - the extended problem - NO - the question  
was - is there a standard way of using caches in Apache, as it seems  
every module does its own thing - in this particular case I don't  
think I should use a cache API. Explanation...

For Thumbnails - most likely: (n hours is configurable)

	* Create image with reasonable expiry (e.g. n hour)
	* On a request for IMS (if mod since) - pass it through to the  
subrequest (i.e. leave it to the original file)
	  (this may be inefficient - might make it configurable)
	* On new request get local file, if modified longer than n hours,  
then check headers of original file
	* If out of date - regenerate, write to disk
	* If in date - redirect to local file and update expiry
	* Note: check the pragma nocache and expiry of original and inherit  
if smaller (for generated objects).

Nice thing about the solution above is that the cache is just files  
on the disk sure, but it is then using Apache to do all the hard  
work. And Apache is already insanely fast at providing files.

The only work it is therefore doing is checking some dates and  
generating the thumbnail if it must.

By checking pragma and expiry it covers the cases when thumbnails  
can't be cached (e.g. generated on the fly).

HOWEVER... If I write code that always generates the thumbnail from  
the original, and plug in mod_cache in front - it is the same  
thing :-) mod_cache already does almost all of the above.

* - *  http://www.osdc.com.au - Open Source Developers Conference * - *
Scott Penrose
Open source developer
scottp at dd.com.au

Dismaimer: Open sauce usually ends up never coming out (of the bottle).

Please do not send me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

Microsoft is not the answer. It's the question. And the answer is no.

More information about the Melbourne-pm mailing list