

#Keylord redis update#
īackground update cache policy, It is carried out in the form of scheduled tasks or message queues redis Cache update or remove, etc. ĭouble key Strategy, Lord key Is the original cache, To prepare key Cache for copy, Lord key When the failure, You can access the backup key, Lord key Cache expiration time is set to short-term, To prepare key Set to long term.

Īdd mutex, So that the operation of building the cache will not be carried out at the same time.

When the expiration time is actually set, A large number of key Scenarios that expire at the same time, If there is, Then by random 、 fine-tuning 、 Set the expiration time by uniform setting, So as to avoid expiration at the same time. and ) What do I do For the case that a large number of cached data expire at the same time : Redis It's not working, Unable to process request, Naturally, the request will be sent to the database. There are two common reasons for the above situation :Ī large number of cached data expire at the same time, As a result, the data that should have been requested to the cache needs to be retrieved from the database. For some time redis A large number of requests processed in the cache, Are sent to the database for processing, As a result, the pressure on the database increases rapidly, In severe cases, it may even cause the database to crash, This leads to the collapse of the whole system, Like an avalanche, Cause a chain effect, So it is called cache avalanche. Two 、 Cache avalanche ( One ) What is it? But in practice, It will have cache avalanches 、 Abnormal conditions such as cache breakdown and cache penetration, If you ignore these situations, it may bring disastrous consequences, The following mainly analyzes and summarizes these cache exceptions and common handling schemes. Of course, the most important thing is to read and write fast, As the most commonly used caching scheme in our daily development, it is widely used. Redis It's completely open source 、 comply with BSD Agreed 、 High performance key-value Data structure storage system, It supports data persistence, The data in memory can be saved on disk, And it doesn't just support simple key-value Data of type, It also provides list,set,zset,hash Such as data structure storage, Very powerful ,Redis It also supports data backup, namely master-slave Mode data backup, To improve usability. Introduction | Redis As a high-performance memory key-value Data structure storage system, It is widely used in our daily development 、 Counter 、 Message queue 、 In leaderboard and other scenarios, Especially as the most commonly used caching method, In improving the efficiency of data query 、 The protection of databases has played an indelible role, But in practice, There may be some Redis Cache exceptions, This paper mainly focuses on Redis The cache exception and its handling scheme are summarized.
