CCookie::getMaxAge

The CCookie::getMaxAge function retrieves the maximum age of the cookie.

int getMaxAge();


Return Type

int
Upon successful completion, an integer which indicates the maximum age of the cookie in seconds is returned. Otherwise, a negative value is returned.


Parameters

None.


Remarks

This function retrieves the maximum age of the cookie. The value of the maximum age is the lifetime of the cookie in seconds. It is a decimal non-negative integer. To handle cached cookies correctly, a client SHOULD calculate the age of the cookie according to the age calculation rules in the HTTP/1.1 specification [RFC2616]. When the age is greater than seconds of maximum age, the client SHOULD discard the cookie. A value of zero means the cookie SHOULD be discarded immediately.

The CCookie::setMaxAge function can be used to set the maximum of the cookie.


See Also

CCookie, CCookie::setMaxAge, CResponse::addCookie, CRequest::getCookies, CRequest::getCookie

Example