title: Get unique Session id in codeigniter
body: <p>I am trying to get session id using session_id(); But I get to know that It will be regenerated after every 5 minutes.</p>
  
  <p>So i got a trick to set random number into a user defined session variable . like ,</p>
  
  <pre><code>$uniqueId = uniqid(rand(), TRUE);
  $this-&gt;session-&gt;set_userdata("my_session_id", md5($uniqueId)); 
  </code></pre>
  
  <p>Now question is where should I place this code. If I place this code in my controller's constructor , It will be executed on each request. and will give me a different session id for each request. </p>
  
  <p>How can I set this session variable only once ? and it will not change until session destroy() .</p>