当前位置:网站首页>Why use redis

Why use redis

2022-07-06 13:39:00 Wake up duck, did you program today?

There are mainly the following two aspects

1、 In terms of high concurrency :

The requests that the direct operation cache can withstand are , Far greater than direct access to the database , So we can consider transferring part of the data in the database to the cache , In this way, some of the user's requests will go directly to the cache without going through the database

2、 In terms of high performance :

The user accesses some data in the database for the first time , Because it is read from hard profit, this process will be relatively slow , Store the data accessed by the user in the cache , The next time you access this data, you can get it directly from the cache , Operation cache is direct operation memory , So it's pretty fast

Why use Redis Not the others , for example Java Self contained map perhaps guava?

Cache is divided into local cache and distributed cache , image map and guava Local cache , The main characteristics of local cache are lightweight and fast , The life cycle follows jivm The destruction of , In the case of multiple instances , Each instance needs to save a cache , Cache is not consistent

Use redis or memcached It's called distributed caching , In the case of multiple instances , All instances share the same cache as the master The cache is consistent .

原网站

版权声明
本文为[Wake up duck, did you program today?]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060916452800.html