I am sending AJAX GET-requests to a PHP application and would like to cache the request returns for later use.
Since I am using GET this should be possible because d
Add the following headers on the server:
header("Cache-Control: private, max-age=$seconds");
header("Expires: ".gmdate('r', time()+$seconds));
Where $seconds has an obvious meaning.
We set an Expires header here even though it should be ignored if Cache-Control header with max-age parameter is set previously because there are clients that do not follow the standard.
Also, check if your server do not issue some other anti-caching headers like Pragma. If so, add Pragma: cache header too.