Search code examples
phpjqueryno-cache

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


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...


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.