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

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

WBOY
WBOYOriginal
2016-12-01 00:25:461007browse

This is my setup:

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

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>

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.

Statement:
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