Advice Zend\Session configuration for ZfcUser

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Advice Zend\Session configuration for ZfcUser

Oscar Fanelli
Hi all, I would like to configure Zend\Session to increase the session time of the user that log in with ZfcUser (with DoctrineOrm in my case).

However, this are the configurations, what do you thing about them?
In particular i have set 1 week to cache_expire, cookie_lifetime, gc_maxlifetime and remember_me_seconds

    'session' => array(
        'config' => array(
            'class' => 'Zend\Session\Config\SessionConfig',
            'options' => array(
                'use_cookies'           => true,
                'cookie_domain'         => 'site.xx',
                'cache_expire'          => 604800,
                'remember_me_seconds'   => 604800,
                'cookie_lifetime'       => 604800,
                'remember_me_seconds'   => 604800,
                'name'                  => 'myname',
            ),
        ),
        'storage'       => 'Zend\Session\Storage\SessionArrayStorage',
        'save_handler'  => 'Zend\Session\SaveHandler\Cache',
        'validators' => array(
            array(
                'Zend\Session\Validator\RemoteAddr',
                'Zend\Session\Validator\HttpUserAgent',
            ),
        ),
    ),

Thanks,
Oscar Fanelli


---

Oscar Fanelli
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167

Reply | Threaded
Open this post in threaded view
|

Re: Advice Zend\Session configuration for ZfcUser

Mike Willbanks
Hi Oscar,


Hi all, I would like to configure Zend\Session to increase the session time of the user that log in with ZfcUser (with DoctrineOrm in my case).

However, this are the configurations, what do you thing about them?
In particular i have set 1 week to cache_expire, cookie_lifetime, gc_maxlifetime and remember_me_seconds

    'session' => array(
        'config' => array(
            'class' => 'Zend\Session\Config\SessionConfig',
            'options' => array(
                'use_cookies'           => true,
                'cookie_domain'         => 'site.xx',
                'cache_expire'          => 604800,
                'remember_me_seconds'   => 604800,
                'cookie_lifetime'       => 604800,
                'remember_me_seconds'   => 604800,
                'name'                  => 'myname',
            ),
        ),
        'storage'       => 'Zend\Session\Storage\SessionArrayStorage',
        'save_handler'  => 'Zend\Session\SaveHandler\Cache',
        'validators' => array(
            array(
                'Zend\Session\Validator\RemoteAddr',
                'Zend\Session\Validator\HttpUserAgent',
            ),
        ),
    ),


Since you are using the Cache save handler; you need to ensure that the cache you are storing it to can save it for that amount of time :)
 

Thanks,
Oscar Fanelli


---

Oscar Fanelli
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167


Reply | Threaded
Open this post in threaded view
|

Re: Advice Zend\Session configuration for ZfcUser

Oscar Fanelli
So what I have to do additionally to what I have done?

Il giorno 05/giu/2013, alle ore 18:33, Mike Willbanks <[hidden email]> ha scritto:

Hi Oscar,


Hi all, I would like to configure Zend\Session to increase the session time of the user that log in with ZfcUser (with DoctrineOrm in my case).

However, this are the configurations, what do you thing about them?
In particular i have set 1 week to cache_expire, cookie_lifetime, gc_maxlifetime and remember_me_seconds

    'session' => array(
        'config' => array(
            'class' => 'Zend\Session\Config\SessionConfig',
            'options' => array(
                'use_cookies'           => true,
                'cookie_domain'         => 'site.xx',
                'cache_expire'          => 604800,
                'remember_me_seconds'   => 604800,
                'cookie_lifetime'       => 604800,
                'remember_me_seconds'   => 604800,
                'name'                  => 'myname',
            ),
        ),
        'storage'       => 'Zend\Session\Storage\SessionArrayStorage',
        'save_handler'  => 'Zend\Session\SaveHandler\Cache',
        'validators' => array(
            array(
                'Zend\Session\Validator\RemoteAddr',
                'Zend\Session\Validator\HttpUserAgent',
            ),
        ),
    ),


Since you are using the Cache save handler; you need to ensure that the cache you are storing it to can save it for that amount of time :)
 

Thanks,
Oscar Fanelli


---

Oscar Fanelli
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167



Reply | Threaded
Open this post in threaded view
|

Re: Advice Zend\Session configuration for ZfcUser

Mike Willbanks
It all depends on how you setup the save_handler... you are using the Cache save handler and depending on the setup of the cache that you supplied to it, you likely have a TTL on the cache that would have to match up.


On Wed, Jun 5, 2013 at 9:49 AM, Oscar Fanelli <[hidden email]> wrote:
So what I have to do additionally to what I have done?

Il giorno 05/giu/2013, alle ore 18:33, Mike Willbanks <[hidden email]> ha scritto:

Hi Oscar,


Hi all, I would like to configure Zend\Session to increase the session time of the user that log in with ZfcUser (with DoctrineOrm in my case).

However, this are the configurations, what do you thing about them?
In particular i have set 1 week to cache_expire, cookie_lifetime, gc_maxlifetime and remember_me_seconds

    'session' => array(
        'config' => array(
            'class' => 'Zend\Session\Config\SessionConfig',
            'options' => array(
                'use_cookies'           => true,
                'cookie_domain'         => 'site.xx',
                'cache_expire'          => 604800,
                'remember_me_seconds'   => 604800,
                'cookie_lifetime'       => 604800,
                'remember_me_seconds'   => 604800,
                'name'                  => 'myname',
            ),
        ),
        'storage'       => 'Zend\Session\Storage\SessionArrayStorage',
        'save_handler'  => 'Zend\Session\SaveHandler\Cache',
        'validators' => array(
            array(
                'Zend\Session\Validator\RemoteAddr',
                'Zend\Session\Validator\HttpUserAgent',
            ),
        ),
    ),


Since you are using the Cache save handler; you need to ensure that the cache you are storing it to can save it for that amount of time :)
 

Thanks,
Oscar Fanelli


---

Oscar Fanelli
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167




Reply | Threaded
Open this post in threaded view
|

Re: Advice Zend\Session configuration for ZfcUser

Oscar Fanelli
I've only implemented this: http://zf2.readthedocs.org/en/latest/modules/zend.session.manager.html

---

Oscar Fanelli
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167

Il giorno 05/giu/2013, alle ore 18:54, Mike Willbanks <[hidden email]> ha scritto:

It all depends on how you setup the save_handler... you are using the Cache save handler and depending on the setup of the cache that you supplied to it, you likely have a TTL on the cache that would have to match up.


On Wed, Jun 5, 2013 at 9:49 AM, Oscar Fanelli <[hidden email]> wrote:
So what I have to do additionally to what I have done?

Il giorno 05/giu/2013, alle ore 18:33, Mike Willbanks <[hidden email]> ha scritto:

Hi Oscar,


Hi all, I would like to configure Zend\Session to increase the session time of the user that log in with ZfcUser (with DoctrineOrm in my case).

However, this are the configurations, what do you thing about them?
In particular i have set 1 week to cache_expire, cookie_lifetime, gc_maxlifetime and remember_me_seconds

    'session' => array(
        'config' => array(
            'class' => 'Zend\Session\Config\SessionConfig',
            'options' => array(
                'use_cookies'           => true,
                'cookie_domain'         => 'site.xx',
                'cache_expire'          => 604800,
                'remember_me_seconds'   => 604800,
                'cookie_lifetime'       => 604800,
                'remember_me_seconds'   => 604800,
                'name'                  => 'myname',
            ),
        ),
        'storage'       => 'Zend\Session\Storage\SessionArrayStorage',
        'save_handler'  => 'Zend\Session\SaveHandler\Cache',
        'validators' => array(
            array(
                'Zend\Session\Validator\RemoteAddr',
                'Zend\Session\Validator\HttpUserAgent',
            ),
        ),
    ),


Since you are using the Cache save handler; you need to ensure that the cache you are storing it to can save it for that amount of time :)
 

Thanks,
Oscar Fanelli


---

Oscar Fanelli
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167





Reply | Threaded
Open this post in threaded view
|

Re: Advice Zend\Session configuration for ZfcUser

Mike Willbanks
You do have this line in your configuration:
        'save_handler'  => 'Zend\Session\SaveHandler\Cache',

Which means that you are fetching the SaveHandler of type Cache.  The TTL from sessions is passed into the SaveHandler\Cache.  But depending on your cache it may drop them out faster or squeeze them out.  In this case when you want your sessions to last a week you should utilize an alternate mechanism.


On Wed, Jun 5, 2013 at 9:55 AM, Oscar Fanelli <[hidden email]> wrote:
I've only implemented this: http://zf2.readthedocs.org/en/latest/modules/zend.session.manager.html


---

Oscar Fanelli
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167

Il giorno 05/giu/2013, alle ore 18:54, Mike Willbanks <[hidden email]> ha scritto:

It all depends on how you setup the save_handler... you are using the Cache save handler and depending on the setup of the cache that you supplied to it, you likely have a TTL on the cache that would have to match up.


On Wed, Jun 5, 2013 at 9:49 AM, Oscar Fanelli <[hidden email]> wrote:
So what I have to do additionally to what I have done?

Il giorno 05/giu/2013, alle ore 18:33, Mike Willbanks <[hidden email]> ha scritto:

Hi Oscar,


Hi all, I would like to configure Zend\Session to increase the session time of the user that log in with ZfcUser (with DoctrineOrm in my case).

However, this are the configurations, what do you thing about them?
In particular i have set 1 week to cache_expire, cookie_lifetime, gc_maxlifetime and remember_me_seconds

    'session' => array(
        'config' => array(
            'class' => 'Zend\Session\Config\SessionConfig',
            'options' => array(
                'use_cookies'           => true,
                'cookie_domain'         => 'site.xx',
                'cache_expire'          => 604800,
                'remember_me_seconds'   => 604800,
                'cookie_lifetime'       => 604800,
                'remember_me_seconds'   => 604800,
                'name'                  => 'myname',
            ),
        ),
        'storage'       => 'Zend\Session\Storage\SessionArrayStorage',
        'save_handler'  => 'Zend\Session\SaveHandler\Cache',
        'validators' => array(
            array(
                'Zend\Session\Validator\RemoteAddr',
                'Zend\Session\Validator\HttpUserAgent',
            ),
        ),
    ),


Since you are using the Cache save handler; you need to ensure that the cache you are storing it to can save it for that amount of time :)
 

Thanks,
Oscar Fanelli


---

Oscar Fanelli
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167