In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "what are the common caches of java?". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the common caches of java?"
Caching is a daily development. If the application has a high frequency of reading certain types of data and changes are small, it is very suitable to use caching to improve performance.
JVM caching
Using global variables, such as Map, List and other containers to store data, can be considered a heap cache
Ehcache
Ehcache is directly cached in the jvm virtual machine with high efficiency and high speed, and the cluster distributed application is not convenient. After vm restarts, cached data can be retrieved from disk after the machine is rebooted.
OSCache supports clustering: cluster cache data can be configured individually without modifying code cache expiration to control the expiration of cache objects to the maximum extent, including pluggable refresh policy cache mode
Guava Cache
Thread safety is also in-heap caching. Support automatic data cleanup, a variety of cleanup algorithms, clear callback, timing failure and other functions, provide three basic cache recovery methods: capacity-based recovery, timing recovery and reference-based recovery. There are two kinds of timing recycling: according to the write time, the earliest write is the first to be reclaimed; according to the access time, the earliest access is the earliest
Distributed cache
Redis, Memcached, Geode and so on are commonly used. In order to prevent a single point of failure, the difference between Redis and MemCache is generally used in highly concurrent systems.
Thread operation Redis is a single-thread operation, which only processes one request at a time. Memcache uses multi-core, multi-thread operation, and can process multiple requests at the same time.
Data structure
Redis support
String: string type
List: list type
Set: unordered collection type
ZSet: ordered collection type
Hash: storage of data structures such as hash table types.
Memcached can only save [key/value]
Data security both Redis and MemCache store data in memory. However, data cannot be recovered after MemCache service downtime or restart, while Redis service can be restored after downtime or restart, and memory data can be synchronized to disk on a regular basis. Redis provides two persistence strategies. RDB persistence and AOF persistence that need to be manually enabled are supported by default.
Data backup Redis supports data backup. You need to enable master-slave master / slave policy.
The expiration policy MemCache specifies the expiration time when set. Redis can set the expiration time of Key through expire.
Memory recovery MemCache has a memory recovery mechanism. When the memory size is set in the program, it will be automatically reclaimed once the stored data exceeds, otherwise memory overflow will occur. Redis persists data to disk, which doesn't happen.
At this point, I believe you have a deeper understanding of "what are the common caches of java?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.