title: How Sessions in Codeigniter Work
body: <p>I am trying to figure out how sessions work in Codeigniter. Reading the online manual, I see the following:</p>
  
  <blockquote>
    <p>If sessions data does not exist (or if it has expired) a new session will be created and saved in the cookie. If a session does exist, its information will be updated and the cookie will be updated. With each update, the session_id will be regenerated.</p>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
    <p>Note: Session cookies are only updated every five minutes by default to reduce processor load. If you repeatedly reload a page you'll notice that the "last activity" time only updates if five minutes or more has passed since the last time the cookie was written. This time is configurable by changing the $config['sess_time_to_update'] line in your system/config/config.php file.</p>
  </blockquote>
  
  <p><strong>Question</strong>: </p>
  
  <ol>
  <li>What information is updated if a session exists when a page with session class is loaded? Is this the session id stored in the cookie, or the session data itself stored in the database?</li>
  <li>Session cookies are only updated every 5 minutes. What if the user goes from page A to page B within 5 minutes, and this requires the addition of new session data? Logically the session data should be updated, so I guess I'm understanding this line wrongly... In this case, I will guess that the session cookie gets a new session id every 5 minutes.</li>
  </ol>
  
  <p>Any clarifications will help!</p>