I have 2 pages that are highly customized per user, and I happen to know exactly when certain users are going to log in (this site is used by students during classtime). I have APC and memcache helping, but they are basically worthless here since my users hit these pages once or twice right at the beginning of their session and don't often return, but may spend over 10 seconds waiting for the page to generate when 40 users all log in at once and try to get the different versions of the same page.

I plan on significantly redoing these pages to make them less resource intensive, but for the moment, I'd love to be able to schedule a cron job to do a cache warm 10 minutes before class starts so they have a better experience sooner. Is there any way to do a cache warm for pages that are custom per user when I don't have their password?


You can use drush user-login together with curl (or wget) like this:

drush --uri=http://your-site.com/drupal-dir-if-any/ user-login --browser=0 username path/to/heavy/site | xargs curl -L

The drush user-login command prints a one-time login link of the following form:


Then xargs will pick it up from stdin and passes it as last command line argument to curl. Finally the -L flag instructs curl to follow redirects. You might want to also supply -o /dev/null in order to discard the output of curl.

  • 1
    As far as I know Drupal does not cache pages for logged in users. But some like filtered text may be cached.
    – AgA
    Jan 30 '14 at 6:51
  • @AgA Drupal can cache for logged-in users, see my answer ;) But you're right, does not do it out of the box.
    – Mołot
    Feb 11 '14 at 15:23

First things first, you probably should start caching these pages. If you don't know, then you don't cache pages for logged-in users at all.

See Authcache module:

The Authcache module offers page caching for both anonymous users and logged-in authenticated users. This allows Drupal/PHP to only spend 1-2 milliseconds serving pages, greatly reducing server resources.

Please note that enabling authenticated user caching will require modifying how your user-customized content displays on your pages. You should be an experienced Drupal developer if you choose to implement the full functionality of this module.

When you will have it, warming mentioned in znerol's answer will be able to make a significant difference.

  • I'm using the Views Per-User-Cache module (drupal.org/project/views_puc), which addresses my major pain points. I don't think Authcache would help me in the short term as I'd need to move a lot of custom user content to ajax/ From Authcache: "Please consider your goals and site functionality carefully, as the final HTML of each cached page must be the same for each user role." Feb 11 '14 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.