A client was using the Advanced Varnish module (https://www.drupal.org/project/adv_varnish) and to my surprise, there was no cache invalidation built into it.

The idea is that whenever a node is updated or deleted, a cache invalidation request is sent automatically to Varnish cache.

The client request was to build a View node listing for the home page (content type = page) but exclude nodes that were flagged to appear in the menu (any menu). I has to use hook_views_query_alter() for this and here is the full example:

Usage:

Load an entity object
$user = entityManage('user', 1);
$node = entityManage('node', 1);

Update a node's title
entityManage('node', 1, ['title' => 'New title']);

The time_diff filter is not a built-in Twig filter in Drupal 9. To achieve the desired functionality, you need to create a custom Twig filter.

Here's a step-by-step guide on how to add a custom time_diff filter in your Drupal 9 site:

Step 1: Create a Custom Module