Issue with uwsgi_cache

Michael Barrett loki77 at gmail.com
Sun Apr 17 23:05:54 MSD 2011


I'm trying to make it so that I can cache certain pages generated by my uwsgi application.  I've had some luck with the following stanzas:

[in http]
uwsgi_cache_path /data/nginx/cache levels=1:2
                      keys_zone=one:1m
                      inactive=7d  max_size=200m;

[in server]
    location / {
        uwsgi_cache one;
        proxy_cache_use_stale   error timeout invalid_header;
        uwsgi_cache_valid 200 1h;
        uwsgi_cache_key djcore$request_uri;
        uwsgi_pass ebdjango_uwsgi;
    }


That works, but only when I go to /.  Any request to any other page is not cached (at least as far as I can tell, no files are created in /data/nginx/cache, and when I run strace I don't see it attempt to open any files).

As well, if I specify the following:

[in server]
    location /help {
        uwsgi_cache one;
        proxy_cache_use_stale   error timeout invalid_header;
        uwsgi_cache_valid 200 1h;
        uwsgi_cache_key djcore/help;
        uwsgi_pass ebdjango_uwsgi;
    }

It still won't cache for the /help page.

At this point it seems that there's something about the way this caching works that either I can't find/understand in the docs, or just plain isn't specified in the docs (less likely).

Has anyone had any luck with this?  Can anyone shed any light on why this might be happening?  I've been fighting with this for a few days now, and I've had no luck whatsoever.

Thanks!
--
Michael Barrett
loki77 at gmail.com







More information about the nginx mailing list