Hello,
What would be the best way to get nginx to store fastcgi cache files in directory depending on available variables just like fascgi_cache_key?
The idea is to cache html files for each session. Consider this example: fastcgi_cache_path /var/cache/nginx/$cookie_SESSION levels=1:2 keys_zone=TEST:10m inactive=5m max_size=200M;
In my latest experiments nginx cache is a way better than storing parts of the page into some caching mechanism like memcached or APC and then rebuild page for each user. Another problem is to purge the cache. I guess ngx_cache_purge module will not work in this case, because I need to clear the cache for each session, not one request. And there is one another problem either. For example. I can clear this cache using backend (php in this case), but it somehow should be done by nginx, because if I request an url, that suppose to clear the cache, next time I visit this url the url is cached and no php script is executed.
Of course I can add execptions to these urls, but if there is a lot of urls, later it will become hard to maintain.
One solution that comes to my mind is to create file "cache_purge" into /var/cache/nginx/$cookie_SESSION/ and when nginx finds this file, it deletes all directory with subdirectories. Can it be done by module? Or maybe somebody have some better suggestion?
Thanks in advance
p.s. Sorry for my english mistakes, if there is any :)