Ehcache is a Java implementation of the open-source distributed cache framework, Ehcache can effectively reduce the load of the database, you can keep the data in different server memory, when the need for data can be quickly accessed. At the same time the Ehcache extension is very simple and there are several official cache configurations available. You can pass in different parameters by declaring the configuration, configuring it in XML, configuring it in a program, or invoking a constructor method.
The following is an architectural diagram of Ehcache:
Ehcache has the following features:
- The access speed is very fast and the performance is very good.
- You can apply multiple cache policies.
- The hierarchical cache allows users to specify what data is cached in the hard disk and which data is cached in memory.
- Distributed caching can be done through RMI, pluggable APIs, and so on.
- A listening interface with cache and cache manager.
- Supports multi-cache manager instances, and multiple cache areas for one instance.
- The cache implementation of Hibernate is provided by default.
Configuration example code for Ehcache:
<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>
In the same Java cache framework, the Ehcache configuration is relatively simple and easy to get started, the biggest advantage is that it supports distributed cache
Java Open Source Distributed cache Framework Ehcache