In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what are the classic application scenarios of Redis". In the daily operation, I believe many people have doubts about the classical application scenarios of Redis. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the questions of "what are the classic application scenarios of Redis?" Next, please follow the editor to study!
Redis is a free and open source compliance with the BSD protocol, is a high-performance NOsql cache Key-value database. Redis supports data persistence. You can keep the data in memory in the word board and load it again after restart. Redis supports simple data of Key-valus type, and also provides storage of data structures such as list set zset hash. It also supports data backup, that is, master-slave replication.
Classic application scenarios of Redis:
1. Cache hotspot data: hotspot data (which is often queried, but not data that has been modified or deleted in entry) is preferred to use redis cache. Redis has excellent performance.
two。 Counter: such as counting clicks, visits, likes, comments, views and other applications, due to single thread, avoid concurrency problems, ensure the correctness of data, and 100 millisecond performance, while enabling Redis persistence to persist data.
3. Single-threaded mechanism: validates repeated requests in the previous paragraph and is free to extend similar situations. You can filter through redis. For example, hash such as request IP, parameters, and APIs are stored as key redis for each request, and the validity period is set. Then the next request is retrieved in redis to see if there is this Key, and then verify whether it is repeatedly submitted within a certain period of time. For example, to limit the number of user logins, it is better to limit the number of wrong logins in a day than how many. Second kill system, based on the single-threaded feature of redis, prevents database oversold, global incremental ID generation, etc.
4. Ranking: whoever has a high score is ranked high, such as high click-through rate, high activity, the highest sales volume, the top 10 with the highest votes, and so on.
5. Distributed locks: distributed locks can be implemented using redis. In order to ensure that distributed locks are available, at least make sure that the implementation of the lock meets the following conditions: mutex, only one client can hold the lock at any time. Deadlock will not occur. Even if a client crashes while holding the lock and does not take the initiative to unlock it, it can also ensure that other customers can be locked and unlocked. Local fault tolerance can only operate normally on most Redis nodes, and customers can add locks and unlocks. Locking and unlocking must be the same client, and the client cannot unlock the lock added by others.
6. Session caching using Redis is a very common scenario. The advantage of caching sessions with Redis over other storage is that Redis provides persistence. At present, a large number of solutions have adopted redis as the storage scheme of Session.
At this point, the study of "what are the classic application scenarios of Redis" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.