Adjust caching for StatisticsPopularBlock

Created on 31 July 2016, over 8 years ago
Updated 30 April 2024, 7 months ago

In #1446932: Improve statistics performance by adding a swappable backend berdir pointed out that the caching of this block could be done better.

Technically, you do need the list cache tag, just like node_title_list. So the code there was pretty much correct. merging in the id cache tags would be "more correct". Problem is, that means *every* time a node is created or saved or deleted, this block needs to be rebuilt. That's quite slow. Especially since we care more about changes in hits than new or updated nodes.

So what I think would be the best combination is only add the cache tags for the specific nodes and set the same max age as we do in statistics_node_links_alter(). That would have the following effect:
* The block is refreshed once per hour, reflecting hit changes
* The block is refreshed when the nodes that are currently shown are updated (so we get a title change for example) or deleted
* The block is *not* updated when new nodes are created or nodes other than the ones shown are updated.

📌 Task
Status

Needs work

Version

1.0

Component
Statistics 

Last updated 5 days ago

No maintainer
Created by

🇧🇪Belgium mallezie Loenhout

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024