I am running WordPress Multisite/Network and would like to have FastCGI keep the cache for an extended period of time (say a week or month). Reason being, we have a plugin that forces the cache to refresh when there are changes, a user can manual refresh the entire site and when we rollout updates we also clear the cache. SO a cached fill is in general "up-to-date"
Here is the code I have currently in my conf file...
fastcgi_cache_path /var/cache/html levels=1:2 keys_zone=FASTCGICACHE:500m
inactive=30d;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
Here are my questions:
- How do I set the inactive for 30 days? is "30d" correct? EDIT: I changed it to be "inactive=10080m" but it seems to still expire after 10 minutes (the default)
- I have noticed that after a period of time (few hours, maybe a day) the server returns "x-fastcgi-cache: EXPIRED" and when I refresh get a "HIT". I know the default for inactive is 10m so if #1 is true (30d not correct)then that would be the cause? If not, any other ideas?
- When "x-fastcgi-cache: EXPIRED" it takes much longer to load the URL, should it not be serving the current version (meaning same fast speed) and then get a new version of the cache?
- My WordPress setup has multiple domains, how can I get the cache to store each first level directory as the domain name instead of the MD5 cache key. (so instead of /s/somereallylong string it would be /example.com/somereallylongstring
So after some research I found parts to my answer and then managed to complete the rest myself.