Cache control for an app

Could someone give me some advice about caching please.

The facts:

  • My app will run over SSL.

  • I don’t want any browser or proxy server to cache any of my pages. (They contain frequently updated data)

In a previous app I added a unique $_GET id to then end of every URL but I am sure there is a better way to achieve this in Yii. If the suggestions are header controls then could someone suggest where I put these within my app so they are applied throughout and if relevant which classes I might extend to do this.

Many thanks in advance.

PS. If anyone can suggest some good caching articles I would be grateful. I find it a bit of a black art :slight_smile:

Hi,

It’s not clear if you’ve already read Caching topic in docs, so if not, then it’s a good start point.

Regards

Hi there

I am not talking about internal caching within the application using CCache component etc… I am talking about setting a concrete set of headers to prevent the client (browser) or any proxy server from caching my pages. I know that in theory most browsers do not cache pages requested through https, but it is the term ‘most’ that I am worried about. I am also not sure which headers proxy servers will always obey.

Take a look at this article: http://symfony.com/doc/current/book/http_cache.html

There is no "response" object in Yii, but still there is a good explanation of HTTP caching.

Many thanks. That is one of the best articles I have read. Just what I was looking for.

I assume that if I were to use PHP rather than apache e.g.

ini_set("session.cache_limiter","nocache"); This is best going at the start of index.php file?