Event subscriber to invalidate a cache I am invalidating a cache tag in KernelEvents::REQUEST event:

public static function getSubscribedEvents() {
  $events[KernelEvents::REQUEST][] = ['onRequest', 100];
  return $events;
}


public function onRequest(GetResponseEvent $event) {
  if ($this-&gt;request-&gt;cookies-&gt;has('myValue')) {
    $this-&gt;cacheTagsInvalidator-&gt;invalidateTags(['my_tag']);
  }
}


When I refresh the page the tag is invalidated but the changes are showing on the next refresh, to which event/hook/etc. do I need to subscribe me to see my changes in single refresh ?

Edit 1:
I have 'Internal Page Cache' module installed. If I uninstall it, the code above works fine.

Edit 2: Added the if condition.
I did it implementing a middleware:

mymodule/mymodule.services.yml:

mymodule.http_middleware:
  class: Drupal\mymodule\StackMiddleware\BeforePageCache
  arguments:
    - '@cache_tags.invalidator'
  tags:
    - { name: http_middleware, priority: 280, responder: true }


mymodule/src/StackMiddleware/BeforePageCache.php

...
/**
 * {@inheritdoc}
 */
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
  if ($request-&gt;cookies-&gt;has('myValue')) {
    $this-&gt;cacheTagsInvalidator-&gt;invalidateTags(['my_tag']);
  }

  return $this-&gt;httpKernel-&gt;handle($request, $type, $catch);
}
...