PHP - Is it better to set session cache limiter to nocache or use jQuery ajax cache:false?

StackOverflow https://stackoverflow.com/questions/7202200

  •  13-01-2021
  •  | 
  •  

Question

Is it better to set session cache limiter to nocache or use jQuery ajax cache:false?

I'm using PHP with jQuery. I want to default session.cache_limiter to nocache for all my php pages that use sessions. That way I don't have to set session_cache_limiter for each page request.

I prefer not to set cache:false when making ajax calls from jQuery because it adds an extra timestamp $_GET to the request. I pass all the values of the $_GET array into MySQL. So I would have to array_pop($_GET) before sending to the database. Thanks...

Was it helpful?

Solution

session_cache_limiter=none seems more clean, but you shouldn't need it anyway. As long as the server sends the correct, noncached content with the correct accompanying headers jquery shouldn't cache anything anyway.

I never had problems because of extra caching. I did have problems when actually trying to make the browser cache my content though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top