Session management using memcached

Asked 1 years ago, Updated 1 years ago, 81 views

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");
  }
}

php memcached

2022-09-29 22:33

1 Answers

Memcached provides the ability to manage sessions to memcache as a standard.
http://php.net/manual/ja/memcached.sessions.php


2022-09-29 22:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.