We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Memcache / Memcached on multiple servers


I'm using Memcache with two memcached servers running on two different IP adresses. In the php.ini, I can assign Memcache to write to both these servers for session redundancy, but with the Phalcon Memcache adapter, I can only point out one IP as the host, which in turn makes is to that if you log in to the site and the load balancer then switches you to our other server, your session will not exist and you'll be thrown out.

How do I use Phalcon's Memcache adapter to write to all servers hosting my memcached deamons, as defined in the php.ini-file?

Thank you.

edited Oct '14

Cool! Thank you!

The Libmemcached actually has a dedicated Session implementation. This solved the issue: \Phalcon\Session\Adapter\Libmemcached.

Thank you for pointing me in the right direction!


Glad you got it working :)