2

I have created a drupal 7 commerce site that displays some real time data to visitors as current number of purchases, upcoming products in the next day or so etc. Is there a way to cache parts of the site / page so that not everything is reconstructed on every request? For example for each product everything can be cached except from the number of current purchases, so I would like to cache images, prices, theme etc, but not the number of current purchases. Is it possible?

2
  • Are the users logged-in at this point? Drupal have different caching option depending on if the user is logged-in or not. – Jens Feb 29 '12 at 8:12
  • Both, users can be either visitors or logged in at this point. – masimplo Mar 1 '12 at 9:11
3

If you use the Page manager together with Panels, then yes, this is trivial. Each "Pane", in a Panel can have it's own cache settings, and they can also be set on a per user basis, meaning you can cache things, even if they include data that is unique for the logged in user.

If you also add Cache actions on top of that, you can add some really aggressive caching that will be cleared only, and exactly, when the relevant data updates.

3
  • I do have Ctools enabled but the nodes are displayed through views using tpl.php files for formatting. If I remember correctly from D6, panels where used to assemble a page from different fields, so no I am not currently using panels, as the job is done by theme files. – masimplo Mar 1 '12 at 9:11
  • Using Panels is the only way I'm aware of for solving your problem. – Letharion Mar 1 '12 at 9:25
  • Since this seems to be the only way possible I have marked this answer as correct. I 'll probably try and use panels sometime in the future. Until then I will have no caching. – masimplo Mar 2 '12 at 11:32

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.