views:

27

answers:

2
$this->getResponse()->addCacheControlHttpHeader('private=True');

What's that for,how does it work?

+2  A: 

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1

private:

Indicates that all or part of the response message is intended for a single user and MUST NOT be cached by a shared cache. This allows an origin server to state that the specified parts of the response are intended for only one user and are not a valid response for requests by other users. A private (non-shared) cache MAY cache the response. Note: This usage of the word private only controls where the response may be cached, and cannot ensure the privacy of the message content.

Amber
How can the browser identify different users?
It can't. These headers are intended to provide info to proxy servers, which serve multiple users, as opposed to a browser which only serves one. (http://en.wikipedia.org/wiki/Proxy_server) Regular browsers simply ignore it since they don't care about multiple users.
Amber
A: 

It's related with the cache control directive.

By default, pages protected with HTTP authentication are considered private; they will not be kept by shared caches. However, you can make authenticated pages public with a Cache-Control: public header; HTTP 1.1-compliant caches will then allow them to be cached.

Elzo Valugi