To speed things up when adding lots of nodes programmatically, it would be good to have an option not to clear the cache on each node_save - cache_clear_all can be called manually at the end of the batch insertion, instead.

Comments

drumm’s picture

Version: 5.x-dev » 6.x-dev
Status: Needs review » Needs work

This probably won't be added to 5 since it is an API change.

We use TRUE instead of 1.

catch’s picture

Status: Needs work » Fixed

Presuming this is fixed by batch api.

pancho’s picture

Version: 6.x-dev » 7.x-dev
Status: Fixed » Needs review
StatusFileSize
new858 bytes

While this is still an API change and we're in API freeze again, I rerolled the patch (using TRUE instead of 1). Move this to D7 though.

edit: whoops, crossed! Can somebody confirm this is superseded by the batch API?

lilou’s picture

StatusFileSize
new820 bytes

Reroll.

moshe weitzman’s picture

Status: Needs review » Needs work

Actually, I prefer to move cache flush to the calling function (the form submit handler) and keeop node_save() as a pure APi function that doesn't clear cache or set messages and so on.

sun’s picture

Title: Provide an option not to clear the cache on node_save » Remove cache_clear_all() from node_save()
Category: feature » task

+1 for what moshe said

moshe weitzman’s picture

Status: Needs work » Fixed

And, we got this done in D7.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Jochus’s picture

I'm afraid this is not the correct issue to ask the following question, but if somebody can point me to a better issue - be my guest?! :-)

Can somebody explain me why Drupal flushes the whole cache after a node has been saved?
We have a lot of content being added/updated, so our cache_block and cache_page gets flushed each +- 5 minutes. We are not able to build a proper set of cache entries. So Drupal is always rebuilding its cache :-( ...

moshe weitzman’s picture

We do that because blocks like 'recent content' and 'recent comments' may be stale so we just flush whole page cache. yes, it is non-smart. see #636454: Cache tag support for improvements in d8

Jochus’s picture

moshe,

Thanks for your answer!
#636454 has some great idea's!

Jochen