Welcome! Log In Create A New Profile

Advanced

fastcgi_cache_path

Posted by gints.murans 
fastcgi_cache_path
February 21, 2010 06:55AM
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 :)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 168
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready