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

max lifetime session memcached

        $memcache = new Phalcon\Session\Adapter\Memcache(array(
            'host'       => '127.0.0.1',          // mandatory
            'port'       => 11211,                // optional (standard: 11211)
            'lifetime'   => (60 * 60 * 24 * 30),  // optional (standard: 8600)
            'persistent' => false                 // optional (standard: false)
        ));

Good day! What is the maximum lifetime that can be set in parameter 'lifetime'?

If you set more than 30 days, then the plug-in does not work ... Need to be at least about 120 days

thx!



2.7k
edited Oct '15

hi, I have the same problem too,

but I figure out, it's not phalcon problem, it's php memcache lib limit

reference: https://php.net/manual/en/memcache.set.php

if you give interger as parameter of lifetime, it may not exceed 2592000.

but you can give UNIX timestamp to make it over 30 days.

for example:

'lifetime' => strtotime('+120 day'),

also you can set it to zero for never expire.
)

also you can set it to zero for never expire. :)

Are you sure?



2.7k

I notice that phalcon has a limit for expire time https://github.com/phalcon/cphalcon/blob/master/phalcon/session/adapter/libmemcached.zep see line 88:

let this->_lifetime = min(lifetime, 2592000);

so... it can not set over 30 days, but it still can set 0 to never expire

I am sure about set zero can never expire

also you can set it to zero for never expire. :)

Are you sure?