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.