Enable microcache options on a per-vhost basis #25

Open
cweagans opened this Issue Jan 20, 2012 · 4 comments

Projects

None yet

2 participants

@cweagans

The use case that I want to fill is something like this:

All sites live in /var/www. Let's talk about example.com.

So, in /var/www, there is a directory called "example.com". Inside that directory, there are three more directories: "dev", "stage", and "prod". Each of those directories contains a complete Drupal installation. It would be very nice to only enable the microcache for the prod installation, and not dev or stage.

@perusio
Owner
perusio commented Jan 20, 2012

Hmm. You can try using something like this "micromodule" that implements hook_init() enable it and then set:

fcgi_cache_bypass $no_cache $http_x_drupal_microcache;
fcgi_no_cache $no_cache $http_x_drupal_microcache;

on the fcgi_microcache.conf file.

This is a nice idea for a very simple but useful module: thanks.

@perusio perusio was assigned Jan 20, 2012
@perusio
Owner
perusio commented Jan 20, 2012

Easier. Just send the X-Accel-Expires: 0 header. I've updated the module. No need to touch any config file. Install the module and enable it. An .info file is missing though.

@cweagans

Could I just hardcode the cache_bypass lines into the vhost for dev and stage? Or do I really need to have a drupal module send that header? I want to skip the cache unconditionally for dev and staging, so it doesn't make a lot of sense to me to add another module to just those environments.

@perusio
Owner
perusio commented Jan 20, 2012

AFAICT the easiest way is for you to add:

add_header X-Accel-Expires 0;

in the index.php location. Or more simply just comment out the include sites-available/microcache_fcgi.conf line :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment