Home > Database > Redis > body text

Does redis support atomic operations?

anonymity
Release: 2019-06-04 16:30:34
Original
3730 people have browsed it

Theoretical knowledge:

Redis is a high-performance key-value database. The emergence of redis has largely compensated for the shortcomings of key/value storage such as memcached, and can play a very good supplementary role to relational databases in some situations. It provides Java, C/C, C#, PHP, JavaScript, Perl, Object-C, Python, Ruby, Erlang and other clients, which is very convenient to use.

Atomicity (atomicity) : A transaction is an indivisible minimum unit of work, either all succeed or all fail.

Does redis support atomic operations?

#Atomic operation means that one of your business logic must be indivisible.

For example, if you transfer money to someone else, your account will deduct money, and someone else's account will add money, this business logic is atomic, and this operation is an atomic operation, either successful or failed.

The execution of all single commands in Redis is atomic.

The principle of redis transaction implementation

1. Batch operations are put into the queue cache before sending the EXEC command

2. Received Enter transaction execution after the EXEC command. If any command in the transaction fails to execute, the remaining commands will not be executed.

3. During the transaction execution process, command requests submitted by other clients will not be inserted into the transaction execution command sequence. middle

The above is the detailed content of Does redis support atomic operations?. For more information, please follow other related articles on the PHP Chinese website!

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!