Getting fastcgi_no_cache to cache the fresh response

kaspars nginx-forum at nginx.us
Sun Apr 17 15:25:29 MSD 2011


I have been trying to find a good and standard way of invalidating nginx
fastcgi cache. Some time ago we had the fastcgi_cache_bypass filter
which was not completely implemented and didn't work (and has been
removed from the wiki since). Now the only option seems to be
fastcgi_no_cache. 

Is there a way to cache that fresh response from the backend when
fastcgi_no_cache is 1? 

Like this:

1. Nginx receives a request with fastcgi_no_cache 1
2. Nginx skips cache and returns a fresh response from the backend
3. Nginx stores that response in the cache
4. All of the subsequent requests when fastcgi_no_cache 0 (with the same
cache_key) return that latest cached response.

Kaspars

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,191844,191844#msg-191844




More information about the nginx mailing list