I'm trying to manage the session using memcached because I'm load balancing two servers.
I have added the following code to all the pages, but the loading is very heavy...
How should I change it?
Please let me know if you know more.
Thank you for your cooperation.
<?php
$mc = new Memcached();
$mc->addServer("ip address", 11211);
if(empty($_SESSION["user"])){
if($mc->get("id")}
$_SESSION["user"]["id"]=$mc->get("id");
}
}
Memcached provides the ability to manage sessions to memcache as a standard.
http://php.net/manual/ja/memcached.sessions.php
© 2024 OneMinuteCode. All rights reserved.