<p>I think you're confusing Craft's <a href="http://buildwithcraft.com/docs/config-settings#userSessionDuration" rel="nofollow">userSessionDuration</a> - which is the amount of time that you can stay logged into the control panel - with PHP's <a href="https://php.net/manual/en/features.sessions.php" rel="nofollow">session</a> (which is what <a href="http://buildwithcraft.com/classreference/services/HttpSessionService" rel="nofollow">craft()->httpSession</a> is a wrapper for).</p>

<p>When you get logged out of the control panel, the former userSession is killed, but you still keep the same underlying PHP session ID and cookie.</p>

CC BY-SA 3.0
2015-04-17T19:05:06.500Z
2015-04-17T19:05:06.500Z
Brad Bell
<p>Here's some relevant detail from my config file:</p>

<pre><code>    'rememberUsernameDuration' =&gt; false,
    'rememberedUserSessionDuration' =&gt; false,
    'userSessionDuration' =&gt; 'PT30S'
</code></pre>

<p>I'm expecting to see sessions timing out after 30 seconds but they don't seem to be, and if I remove that they are still valid beyond the default time.</p>

<p>Now, one thing I'm doing is setting a session directly in a plugin:</p>

<pre><code>craft()-&gt;httpSession-&gt;add('myKey', 'myData');
</code></pre>

<p>And retrieving:</p>

<pre><code>craft()-&gt;httpSession-&gt;get('myKey');
</code></pre>

<p>Am I missing something here? The config file definitely affects the Craft CMS login session as with the config above I get constant warnings to keep my session open in the CMS.</p>

<plugin-development><session>
Session key not timing out when set in a plugin
# Session key not timing out when set in a plugin

(Asked by: username_0 on 2015-04-15)

Here's some relevant detail from my config file:
    'rememberUsernameDuration' => false,
    'rememberedUserSessionDuration' => false,
    'userSessionDuration' => 'PT30S'

I'm expecting to see sessions timing out after 30 seconds but they don't seem to be, and if I remove that they are still valid beyond the default time.
Now, one thing I'm doing is setting a session directly in a plugin:
craft()->httpSession->add('myKey', 'myData');

And retrieving:
craft()->httpSession->get('myKey');

Am I missing something here? The config file definitely affects the Craft CMS login session as with the config above I get constant warnings to keep my session open in the CMS.

**Tags:** plugin-development, session

---

## 1 answers

### Answer by username_1 on 2015-04-17. Score: 1

I think you're confusing Craft's [userSessionDuration](http://buildwithcraft.com/docs/config-settings#userSessionDuration) - which is the amount of time that you can stay logged into the control panel - with PHP's [session](https://php.net/manual/en/features.sessions.php) (which is what [craft()->httpSession](http://buildwithcraft.com/classreference/services/HttpSessionService) is a wrapper for).

When you get logged out of the control panel, the former userSession is killed, but you still keep the same underlying PHP session ID and cookie.


---

