1

Is there any way to cache response headers along with the response body in Memcached for use with Nginx?

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
Dingo
  • 44
  • 6

1 Answers1

1

If you want cache responses in memcached you have to store your information in it manually by using something like a script. Nginx is not web accelerator like squid or varnish if you need that functionality out of the box take a look at varnish. It is working perfectly with nginx also.

hostmaster
  • 553
  • 2
  • 6
  • Yes, I know it. I'm using Django as a backend and write the response to Memcached from there. But how can I cache response headers too? Because by default Nginx adds only it's own headers to response body read from Memcached. –  Aug 27 '12 at 07:20
  • It seems I got you but what exactly http headers are you talking about ? – hostmaster Aug 27 '12 at 07:26
  • For a sample, I wish to control client caching, i.e. use such headers as "Expires", "Cache-Control", proper "Last-Modified" is also appreciated. Of course, with different values for different pages. –  Aug 27 '12 at 12:24
  • 1
    I'm afraid you should use http://wiki.nginx.org/HttpHeadersModule instead OR use another memcached plugin https://github.com/bpaquet/ngx_http_enhanced_memcached_module – hostmaster Aug 27 '12 at 12:53
  • I mean vanila ngx_http_memcached_module do not allow to store HTTP headers with data. For example, pages served by Nginx via Memcached storage have the default Nginx Content-Type. – hostmaster Aug 27 '12 at 13:00
  • Thank you very much! ngx_http_enhanced_memcached_module works like a charm for me :) –  Aug 28 '12 at 05:08