How to use cache ignore callback?

I need to exclude an array of ids and additional pages with specific templates?

Cache in generel is working, only my callback doesn’t get desired result, my attempt doesnt ignore the desired pages

return [
    'debug'  => true,
    'languages' => true,
    'cache' => [
      'pages' => [
        'active' => true,
        'ignore' => function($page) {
          if ($page->intendedTemplate() === 'instrument') {
            return true;
          }
        }
      ]
    ],
    'license' => '---'
];
if ($page->intendedTemplate()->name() === 'instrument') {

$page->intendedTemplate() returns an object, not a string.

1 Like

thanks!