Rails action_cache plugin updated to use x-sendfile
I’ve just checked in an update to my Rails action_cache plugin. The main change is that now, under the right conditions, the plugin will serve up the cache content using the X-Sendfile header supported by lighttpd and other web servers.
To use the X-Sendfile functionality, three things need to be configured:
- X-Sendfile support enabled in the web server
- The environment variable ENABLE_X_SENDFILE must be set
- The Rails fragment cache store must be set to use the FileStore class
The internal format of the cache has been changed to support the X-Sendfile code. Now the cache entry is stored in two fragments, one for meta-data and headers, the other for the response body.
The README has more info on how to set this up.