The simple stat_cache engine only caches for one second. On large static servers with sparse file changes, it could be a good idea to cache for a few more seconds - especially if you have really hard concurrency.
The attached patch uses a macro, which set the timeout to 1/4 minute. I think a config variable is not needed, but maybe a port to the build system.
Updated by gstrauss over 5 years ago
While patch is trivial, the question remains "should this be done here?" I think the answer is no. There are better alternatives.
server.stat-cache-engine = "simple" is intended to be exactly that: simple, and so I think the 1 second stat cache is reasonable. A better alternative, where available, is server.stat-cache-engine = "fam" which will reduce the stat() calls for filesystems that seldom change.
For highly loaded websites a caching proxy such as Varnish or Squid is recommended, as is offloading to a CDN for really high volume. Any of these will be much more efficient than just extending time to cache stat values.
Also available in: Atom