Reputation: 3364
We are using Memcached - specifically ElastiCache to store sessions between our load balanced servers.
Occasionally there is heavy load on our application and it would appear our session handler fails to connect, and fails silently? As far as I am aware this is not an eviction problem.
ini_set("session.save_handler", "memcached");
ini_set("session.save_path", "AAA-session.XXX.YYY.ZZZ.cache.amazonaws.com:11211");
I was curious if there was a way we could configure the memcached session handler to automatically reconnect or some other more useful response than kicking a user to the login page.
Upvotes: 1
Views: 458
Reputation: 1179
A more robust way of using Memcache for session storage is implementing the save handler yourself. You can do this with session_set_save_handler.
This way, you could check if the connection is made in the open(string $savePath, string $sessionName)
method of your handler, and if not, retry.
Upvotes: 1