Synchronization problem of Redis and relational database __ database

Source: Internet
Author: User
Tags redis
Redis is a high-performance key-value database. The emergence of Redis, to a large extent, compensates for the shortage of such key-value storage in memcached, and in some cases can complement the relational database well. It provides a python,ruby,erlang,php client and is easy to use.
According to our general use of the Redis scenario should be this:

In other words: We will first go to the Redis to determine whether the data exists, and if so, return the cached data directly. If it does not exist, it will go to the database, read the data, and cache the data into the Redis. Application: If the amount of data is relatively large, but not often update the situation (such as user ranking) and the second type of Redis, and the first case is different, the specific situation please see:


Here we will first go to Redis to determine whether the data exists, if there is, then directly update the corresponding data (bar corresponding to the updated key records, such as also saved to Redis, key for Save_update_keys), and the updated data returned to the page, and if not saved , you will update the contents of the database first, and then save the data to Redis. Behind the work, the background will have the relevant mechanism to the REDIS in the Save_update_keys stored key, read out, find the corresponding data, updated to the DB. Advantages: The main purpose is to use Redis as a database, update access to data than DB block, very suitable for large data volume of frequent changes (such as micro-BO), shortcomings, the dependence on Redis is very large, to do a good job of data storage downtime.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.