How to invalidate a views cache based on custom criteria?
-
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.
-
Answer:
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 http://drupal.org/node/875152 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.
Egil Hansen at Drupal Answers Visit the source
Other answers
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.
mikeytown2
Related Q & A:
- How To Make A Custom Motorcycle?Best solution by Yahoo! Answers
- How to edit a custom region from an Omega subtheme in Drupal 7?Best solution by Drupal Answers
- How to convert a SQL query into hibernate criteria?Best solution by Stack Overflow
- How to clear a browser's cache?Best solution by Yahoo! Answers
- How to create a science-based monopoly?Best solution by forevergeek.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.