Home  >  Article  >  Java  >  5 powerful Java distributed caching framework recommendations

5 powerful Java distributed caching framework recommendations

Y2J
Y2JOriginal
2017-04-18 14:11:572384browse

When developing medium and large Java software projects, many Java architects will encounter database read and write bottlenecks. If you do not take the caching strategy into consideration when building the system, or do not choose a better caching strategy, then It would be a nightmare to refactor. This article mainly shares 5 commonly used Java distributed caching frameworks. These caching frameworks support the cache read and write functions of multiple servers, making your caching system easier to expand.

1. Ehcache – Java distributed cache framework

Ehcache is an open source distributed cache framework implemented in Java. EhCache can effectively reduce the load of the database and allow data to be stored in The memory of different servers can be quickly accessed when data is needed. At the same time, EhCache extension is very simple, and there are several officially provided Cache configuration methods. You can configure it by declaring it, configuring it in xml, configuring it in the program, or passing in different parameters when calling the constructor method.

Ehcache has the following characteristics:

  • The access speed is very fast and the performance is very good .

  • A variety of caching strategies can be applied.

  • Hierarchical caching, users can specify which data is cached on the hard disk and which data is cached in the memory.

  • Distributed caching can be performed through RMI, pluggable API, etc.

  • Listening interface with cache and cache manager.

  • Supports multiple cache manager instances, as well as multiple cache areas for one instance.

  • The cache implementation of Hibernate is provided by default.

Ehcache configuration example code:

<ehcache>
 <diskStore path=”java.io.tmpdir”/>
 <defaultCache
 maxElementsInMemory=”10000″
 eternal=”false”
timeToIdleSeconds=”120″
 timeToLiveSeconds=”120″
 overflowToDisk=”true”
maxElementsOnDisk=”10000000″
 diskPersistent=”false”
diskExpiryThreadIntervalSeconds=”120″
 memoryStoreEvictionPolicy=”LRU”
/>
 </ehcache>

Among similar Java caching frameworks, Ehcache configuration is relatively simple and easy to get started. The maximum The advantage is that it supports distributed caching

The above is the detailed content of 5 powerful Java distributed caching framework recommendations. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn