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)06/01 Report--
This article mainly introduces the difference between local cache and redis cache, the article is very detailed, has a certain reference value, interested friends must read it!
Local caching differs from redis caching in the following ways:
1. Read and write speed, regardless of concurrency, the local cache is naturally the fastest. But if the local cache is not locked, what if it should be concurrent? So, let's compare it again in the way of locking.
2. In the scenario, the same data is fetched from the database and put into redis only once, while it needs to be put into the local cache for n cluster times. The local cache cannot be used for repeated clicks, which will distribute the request to multiple servers. Using the local cache can only prevent local repeated clicks, which can be prevented by redis, but the time interval also needs to be outside the read-write difference of redis.
3. Redis memory may be expanded more than n, but the cost of locally expanding heap memory is very high.
4. The local cache needs to implement the expiration function on its own, and poor implementation may lead to extremely serious consequences, while redis has been verified by a large number of traffic, and many loopholes do not need to be tested and secure.
5. Local cache can not provide rich data structure, redis can. Redis can be written to disk, persisted, and local caching cannot or is troublesome to consider too many things.
6. The use of local cache is very likely to cause serious thread safety problems and serious concurrency considerations. After adding the local cache, the code complexity increases sharply, and it is difficult for the developers to grasp the original development ideas. Indirectly increase maintenance costs.
These are all the differences between the local cache and the redis cache. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.