Will there be any concurrency and consistency issues when PHP sessions are stored in redis? Isn't redis writing atomic?

WBOY
Release: 2023-03-01 18:08:02
Original
1030 people have browsed it

This is my setup:

<code>ini_set(“session.save_handler”,”redis”);
ini_set(“session.save_path”,”tcp://127.0.0.1:6379″);
</code>
Copy after login
Copy after login

Reply content:

This is my setup:

<code>ini_set(“session.save_handler”,”redis”);
ini_set(“session.save_path”,”tcp://127.0.0.1:6379″);
</code>
Copy after login
Copy after login

It really won’t happen, it’s already been said here: PHP writes to redis


I researched and found that it still happens, because after reading a key, redis is not locked, so another http request may change the data, and then the original value will be overwritten.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!