Some time we want access to some kind of Session Data. For this purpose we launch a request like:
return \Sifo\Session::getInstance()->get( 'user_data' );
In this case we can work with two different options:
false -> the user is unlogged
some_data -> the user is logged and we have loadded the expected data.
This operation has a small problem. The Session getinstance op is responding a Session start and this operation sends a PHPSESSID cookie to the user.
Everybody know that cookie have a money cost (tranfer and time). But, if we use some kind of middle cache like Varnish or Akamay probably we are not caching the response because http head change :(.
I purpose use this option:
$filter_cookie = FilterCookie::getInstance();
if( $filter_cookie->getString( 'PHPSESSID' ) )
{
return \Sifo\Session::getInstance()->get( 'user_data' );
}
return false;
It's easy and cheap :)
Have a nice weekend.
Sergio