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

Can't destroy Session stored in Memcached

Hi all.

For info, running Phalcon 2.0.7/PHP 5.6.10.

Developing an application where I use Memcached (Phalcon\Session\Adapter\Libmemcached) for:

  • Database meta data
  • General caching across the application
  • Session

All works great, the metadata is stored and works, general caching too and Sessions are created, stored and works

... except for that I cant seem to be able to destroy the session on user sign out.

I have checked this forum and Googled it, but havent found any solution yet, only people having same problem.

Has anyone had success with destroying Sessions in Memcached ?

Would be great, Memcached should works fine for these purposes, except that last detail. Otherwise there is no other way around it than switching to Redis, which sadly is quite a bit slower than Memcached.

Regards /sonny

edited Nov '16

Just do yourself a favor and use $this->session->remove('yourAuthKey');.

P.S. You should use Phalcon 2.0.13 even though it is not supported anymore (current stack is 3.0.x).



9.0k

Have upgraded to V3. But the Remove session does not really work. A workaround is to overwrite session with blank values and just let session time out "garbage collection" deal with it...

But in the end we opted for using Redis instead...