How to tell if a view gets cached? I assume that as soon as you add a contextual filter, that is not a fixed value, the View becomes uncachable since it becomes dynamic, right?

Is there a clear cut way to tell if the View gets cached or not?
I assume that as soon as you add a contextual filter, that is not a fixed value, the View becomes uncachable since it becomes dynamic, right?


No.

That just means that the view's output varies based on the URL. Specifically, a query argument.

This is why we in Drupal 8 have the concept of cache contexts: https://www.drupal.org/developing/api/8/cache/contexts.

For the Views module to efficiently determine whether a view can have a cached version or not, we need to know ahead of time which contexts a particular view display varies by. So, upon saving a modified view, the Views module iterates over all plugins that a particular view display uses and gathers its cacheability metadata. It then stores it in the view config entity.

Concrete example: the "Taxonomy Term" view that ships with Drupal 8 core. It has a path of /taxonomy/term/%, with that % being a particular taxonomy term ID. Open core/modules/taxonomy/config/optional/views.view.taxonomy_term.yml and scroll all the way to the bottom. You'll see this:

page_1:
    id: page_1
    display_title: Page
    display_plugin: page
    position: 1
    display_options:
      query:
        type: views_query
        options: {  }
      path: taxonomy/term/%
      display_extenders: {  }
    cache_metadata:
      contexts:
        - 'languages:language_interface'
        - url
        - 'user.node_grants:view'
        - user.permissions
      max-age: -1
      tags: {  }


Note the presence of the url cache context. That describes that this view varies by URL, in particular by the value for the % wildcard in the /taxonomy/term/% URL.