When a node in a book is updated all caches associated with that book are flushed. When the user visits the page, it will fill the cache bin for that page as to what it's next and previous nodes are so that the next time the page is requested this doesn't cost anything (performance wise).

As a user experience performance improvement, consider using cron to (re)build your cache bin, in addition to the next user visit.

A bunch of module already have cron rebuild code you can copy it from. There also might even be a module just for that, but you'd have to search.

Best,
Michael

Check https://www.drupal.org/project/boost crawler, although I'm sure there are easier implementations to copy it from.

Comments

btopro’s picture

so are you saying we should cache prime via a similar method or recommend projects that do? Could see advantages to doing both potentially.

Cache prime of the book module would probably look like this:
Load all books / pages
call to render the node / page.

This seems like it would be redundant with other projects that are doing this though doesn't it?
We probably need another method that's just called inside of template_preprocess_book_cache_navigation since right now the function itself is doing the evaluation of if it should prime / is primed.

Suggested solution:
make a function out of template_preprocess_book_cache_navigation that is just the priming (taking input as the node / menu item in question)
hook_cron which then also can call that function
load all nodes in books, call that function, let it populate the prev/next.

Still, this all seems like a lot of work to gain on something other caching systems will pick up automatically.

btopro’s picture

I'll accept a patch tho :)

damienmckenna’s picture

Another question to help clarify this - why would you want to clear the cache more often? The more often the caches are cleared the more of a performance drain the site becomes.

btopro’s picture

Component: Code » Documentation
Category: Feature request » Support request
Status: Active » Postponed (maintainer needs more info)

I feel like this should fall under documentation. Using something like https://www.drupal.org/project/httprl_spider or boost crawler by itself seems to make more sense to me anyway since this is just a small part of a page. It seems kind of silly to supply things to build this separate of the render engine being cached for the page.

I have to agree w/ @DamienMcKenna, why would we want to clear on cron when they'll clear / rebuild naturally as they are supposed to be rebuilt?