1

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:

  1. 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)
  2. 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?
  3. 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?
  4. 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
Kalman
  • 71
  • 1
  • 4

1 Answers1

0

So after some research I found parts to my answer and then managed to complete the rest myself.

  1. inactive needs to be in minutes or "m" so 10080m
  2. Learned something new. Inactive is something used by the system internally to clean old files and is not related to the cache EXPIRE. That is "fastcgi_cache_valid" defines whether a cache is expired, H/T Nginx fastcgi_cache_valid vs fastcgi_cache_path's inactive
  3. This was a misunderstanding of how "fastcgi_cache_use_stale" is used. From what I understand this is only used if the application server (building with PHP or whatever) builds the page breaks it will fall back to stale, but if the application server is working it will wait for the new version.
  4. Still no answer to this one.
Kalman
  • 71
  • 1
  • 4