4

I have a custom content type (story) with a datetime field which determines if a story shows up in a the views that list the nodes of that content type; if the datetime defined for a node is newer than the current datetime, it will not show up.

My problem is that I have to go and empty admin/config/development/performance and click Clear all caches or uncheck Cache pages for anonymous users.

I would like to keep caching pages for anonymous users, so I am looking for other options.

Any help is much appreciated.

2 Answers 2

3

It sounds like the problem is not views being cached, but that the entire page is being cached. If Drupal have a complete page cached, it doesn't matter if the view is cached or not. What you need to do, it to conditionally disable the page cache, or prevent Drupal caching that page in the first place.

There have been some talk about how to do the first, but this is not something I have tested or can advise.

Be warned, that messing with the Drupal caching system can give some unforeseen problems.

An alternative solution would be to empty the page cache or invalidate the cache for that particular page once a day/hour to make sure that it's relatively up to date. This is probably the route I would take in this situation.

1
  • Your link that you provided can be solved with logic in settings.php. I helped RockSoup setup cache logic for a mobile theme and desktop theme; depending on your browser you can get 2 different themes just by pointing to the same URL. drupal.org/node/361832#comment-4204294
    – mikeytown2
    Commented Mar 24, 2011 at 7:13
1

I have a patch for boost that does exactly what you want, because that is a requirement of our setup. Problem is it needs an external crawler; we check for new content every 30 seconds across our 1,100 domains and re-crawl them. What you want can be done; But I'm still working on the details of making it work for the average setup. This is also for D6, so not much help for you.

Long story short you need something external to see if the time is up OR some logic in settings.php that handles this. That something external would be cron most likely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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