Php uses memcache to store session data loss. first test the code. you can also test index. php & lt ;? Phpsession_start (); $ method & nbsp; = & nbsp; $ _ GET ['method']; if (isset ($ _ SESSION ['Me php uses memcache to store session data loss problem
Test the code first. you can also test it.
Index. php
session_start();
$method = $_GET['Method'];
if(isset($_SESSION['Method'])){
$_SESSION['Method'] = $_SESSION['Method'].$method;
}else{
$_SESSION['Method'] =$method;
}
?>
Clent.html
Untitled Document
Script
Script
Script
Script
Script
Script
After that, you can print out the SESSION and check that data is often lost. SESSION records are often incomplete. I don't know why. please explain it with experts.
Other configurations are attached below.
Libevent-2.0.18-stable.tar.gz server
Memcached-1.4.13.tar.gz server
Memcache-2.2.6.tgz PHP client
PHP. ini
Session. save_path = "tcp: // 192.168.234.234: 11211"
Session. save_handler = memcache
PHP components
Php_memcache.dll version 2.2.6.0:
------ Solution --------------------
Reference:
... Of course, the problem was discovered only after reading ..
I traversed the data in memcache, but it was not written in. It is not unread.
You just don't understand what I mean.
I mean: it's good to read it right away. it means it's written.
What do you think?
------ Solution --------------------
You should consider the browser's almost concurrent requests. your new value is set based on the value read several milliseconds ago. At this time, it is entirely possible that a new value is successfully inserted. If you insert a new value, the new value written in the previous step is overwritten immediately. Therefore, data loss is normal.
You can write a test on the client or server to compare the effect of one second of pause and concurrent execution.
------ Solution --------------------