Zend Framework 2 (ZF2) auth session refresh using storage

I have looked all over and I can see where people have created the initial session for ZF2 auth, remember me's, etc, but I can't find where people are updating the session when there is activity. Basically, I already have an authentication (with doctrine) system and my current solution and I set up the following configuration setting:

return array (
    'session' => array(
        'cookie_lifetime' => 1800, // 30 min
        'remember_me_seconds' => 1800, // 30 min
        'use_cookies' => true,

Then what I am trying to do is RELOAD this on every request like this: NOTE: I have code that only does this if the user is already logged in.

class Module
    public function onBootstrap(EventInterface $e)
        $this->getEventManager()->attach('route', array($this, 'onRoute'), -100);

    public function onRoute(EventInterface $e)
        $sessionConfig = new SessionConfig();
        $sessionManager = new SessionManager($sessionConfig);

My basic need is I'm trying to refresh the session (server and client) anytime there is a request, but 1. it feels like I'm re-creating it every time and 2. Sometimes the session seems to randomly die. I think this is because the original session dies after the 30 min I set it to.

Any advice?


PHP should be updating the session time for you, you don't need to do it manually.

Also, don't call rememberMe() on every request, as this will generate a new session token (assuming the session already exists).

Need Your Help

jQuery Ajax passing the Form Collection

c# jquery

I was wondering if it is possible to pass the forms collection from within an ajax method in jQuery?

Where should I place downloadable files for my component?

php .htaccess joomla components assets

I am developing a Joomla Component which will allow visitors to download a sound file (be it mp3, or wave, does not matter). Those files are managed in the admin interface and can be unpublished in...