'Clear site browser cache in php

trying to Clear browser site cache in php,

for firefox browser is working fine, as we want but when i run in chrome it didnt work. see code,


 header('Clear-Site-Data: "cache", "cookies", "storage", "executionContexts"'); //Firefox
 
 // Crome
 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
 header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");  
 header ("Cache-Control: no-cache, must-revalidate");  
 header ("Pragma: no-cache");
 header('Clear-Site-Data: "cookies"');
                
 return $this->getSuccessResponse("Token Valid"); 


Solution 1:[1]

I think you can't clear cache from browser perfectly, one only option is you can do manually. There is some code. I hope it will work.

<?php 
  header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
  header("Cache-Control: post-check=0, pre-check=0", false);
  header("Pragma: no-cache");
?>

Solution 2:[2]

Since each object in group A connects to two objects in group B, then you can think of the problem as a graph -- the group A objects are edges, and the group B objects are nodes.

Your problem is then to find a minimum edge cover: https://en.wikipedia.org/wiki/Edge_cover

Thankfully there are polynomial time solutions. The simplest one is to use the Blossom algorithm to find a maximum matching, and then to choose arbitrary edges for the vertices that aren't covered.

Each edge (B object) in the maximum matching covers 2 distinct A objects, and the remaining edges (B objects) cover one new A object each.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 apokryfos
Solution 2