NginxHttpMemcModule vie NginxHttpMemcachedModule

Piotr Sikora piotr.sikora at
Tue Dec 29 08:01:12 MSK 2009

> BTW, none of them can be serve as a transparent content cache out of
> the box. I can think of a ngx_cache module just like Apache2's
> mod_cache (with various storage backends like mod_disk_cache,
> mod_mem_cache, and mod_libmemcached_cache in that context). Is anyone
> already working on that?

I've got mixed feelings about this.

Regarding memcached / other storage backends:
I would love to see memcached module which would be able to act as a 
transparent cache for proxy/fastcgi/slowfs and save content to memcached 
cluster(!), but the way I see it, it cannot be easily implemented as a 
module. In my opinion change of storage backends should be as transparent as 
possible, which means that this should be implemented as modification of 
existing {proxy,fastcgi,slowfs}_cache_path or addition of similar 
{proxy,fastcgi,slowfs}_memcached_path and nothing more (from configuration 
point of view).

This should be fairly easy to implement as a patch. Calling memcached_set 
function instead of ngx_ext_rename_file() in ngx_http_file_cache_update() 
should do the trick for writing and calling memcached_get function instead 
of ngx_http_file_cache_read() in ngx_http_file_cache_open() should do the 
trick for reading ;)

(Yes, I already did the hard part :P)

Implementing this as a module probably wouldn't be as easy and as clean 

But does anyone actually need such feature?

Regarding ngx_cache module:
I believe it is NOT needed. It would be a lot(!) of code replicated from 
nginx base, which would be a nightmare to maintain and keep compatible with 
all existing nginx versions. Also, it wouldn't add any real benefits over 
existing {proxy,fastcgi,slowfs}_caches and memcached storage backend 
described above.

But this is just my opinion ;)

Best regards,
Piotr Sikora < piotr.sikora at >

More information about the nginx mailing list