We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

when I set two session service in serices(DI), Will it work in two name?

        >
        > //设置memcache session缓存
        > $di->set('session', function(){
        >     $memcache = new Phalcon\Session\Adapter\Memcache(array(
        >         'uniqueId'   => 'm1',
        >         'host'       => '127.0.0.1',
        >         'port'       => 11211,
        >         'lifetime'   => 1200,            // 1200 20分钟
        >         'prefix'     => 'xxf',
        >         'persistent' => true
        >     ));
        >     $memcache->start();
        >     return $memcache;
        > });
        > 
        > //设置memcache session缓存
        > $di->set('smssession', function(){
        >     $memcache = new Phalcon\Session\Adapter\Memcache(array(
        >         'uniqueId'   => 'msms',
        >         'host'       => '127.0.0.1',
        >         'port'       => 11211,
        >         'lifetime'   => 300,            // 300 5分钟
        >         'prefix'     => 'xxf',
        >         'persistent' => false
        >     ));
        >     $memcache->start();
        >     return $memcache;
        > });

will session and smssession work ? but my smssession seems donest work , lifttime is not 300.



4.1k
Accepted
answer

If you try use another port for second instance?



27.0k

I dont know but I want to use two session different lifetime, how to do this?