0

I must admit some of this caching stuff is over my head, so this may be a misunderstanding on my part of how this is supposed to function.

But essentially I have a View with the following traits:

  • pulling six different fields (2 text, 2 date, 1 boolean, 1 image - although that's just a text string too, right?)
  • four filters with two exposed to users
  • full pager showing 15 items per page (30+ items was making mysql go away)
  • sorted by date and sticky
  • time-based cache is turned on. Settings: query results-never, rendered output-5 mins

Amount of data being pulled is huge: over 4,700 records

Only other caching solution on the site is stock Drupal page caching for anonymous and blocks, both enabled. Cron is running every day although I suspect it fails sometimes.

The default filters are supposed to show all events from "time - now" until there are no more future event nodes.

Problem is, the cache sometimes shows "Now" as being yesterday or two days ago.

Shouldn't the cache refresh every five minutes? Am I misunderstanding how this setting works? Shouldn't the View show up-to-date data even if cron doesn't run, or is cache expiration dependent on the cron running successfully? Or is the stock Drupal page cache overriding the Views cache for anonymous users?

Thanks!

  • Hi @wickedskaman . Indeed Drupal page cache is overriding the Views cache for anonymous users. When bootstrapping, Drupal is checking whether a page can be served from cache before hitting any Views page callback. Hope this helps. – Claudiu Chirilov Jan 07 '17 at 18:09
  • @ClaudiuChirilov yeah I realized I was mistaken about how it uses caches. If I exclude the view from the Drupal cache and use the time-based cache, will it work as expected? Thanks! – wickedskaman Jan 08 '17 at 01:49
  • yes, you could exclude the page using [CacheExclude](https://www.drupal.org/project/cacheexclude) module depending if it's a page or block that your view is using. – Claudiu Chirilov Jan 08 '17 at 16:58
  • Also drupal Cron runs based on a trigger request. Drupal checks for cron run each time it receives a request. It fails if it doesnt get a request with in specified interval. _Cron is running every day although I suspect it fails sometimes._ This could be happening overnight or when there is not much activity on website. – Sandeep Jan 12 '17 at 19:50
  • @Sandeep you're referring to the built-in cron, right? Not a set crontab scheduled through shell or CPanel? – wickedskaman Jan 12 '17 at 21:29
  • @wickedskaman Yes, I meant cron builtin drupal. If it is crontab or cpanel it should be fine – Sandeep Jan 13 '17 at 15:47
  • @Sandeep thanks for your contribution! – wickedskaman Feb 04 '17 at 01:48
  • @ClaudiuChirilov thanks for your contribution! – wickedskaman Feb 04 '17 at 01:48

0 Answers0