Introduction to Ehcache.xml in Java Web projects _java

Source: Internet
Author: User

Copy Code code as follows:

<?xml version= "1.0" encoding= "UTF-8"?>
<ehcache xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:nonamespaceschemalocation= "Ehcache.xsd" updatecheck= "false"
monitoring= "AutoDetect" dynamicconfig= "true" >

<diskstore path= "Java.io.tmpdir"/>

<defaultcache maxelementsinmemory= "10000" eternal= "true"
Overflowtodisk= "true"
maxelementsondisk= "10000000" diskpersistent= "false"
diskexpirythreadintervalseconds= "memorystoreevictionpolicy=" "LRU"/>

</ehcache>

Name: Cached names.
Maxelementsinmemory: Maximum cache count.
Eternal: The object is permanently valid, but the timeout will not work.
Timetoidleseconds: The allowable idle time (in seconds) before the object is invalidated. When Eternal=false, the optional attribute, the default value is 0, that is, can idle time infinity.
Timetoliveseconds: The object is allowed to survive before it expires (in seconds). The maximum time is between the creation time and the expiration time. When Eternal=false is used, the default is 0, which means that the object survives indefinitely.
Overflowtodisk: When the number of objects in memory reaches Maxelementsinmemory, Ehcache writes the object to disk.
DISKSPOOLBUFFERSIZEMB: This parameter sets the buffer size of the Diskstore (disk cache). The default is 30MB. Each cache should have a buffer of its own.
Maxelementsondisk: Maximum number of hard disk cache.
Diskpersistent: The virtual machine Restart period data is cached, and the default value is False.
Diskexpirythreadintervalseconds: Disk failed thread run time interval, default is 120 seconds.
Memorystoreevictionpolicy: When the maxelementsinmemory limit is reached, Ehcache will clean up the memory according to the specified policy. The default policy is LRU (least recently used). You can set it to FIFO (first-in first Out) or LFU (less used).
Clearonflush: Clear when the maximum amount of memory is available.

<diskStore> indicates that the cache object is written to the hard disk when the number of objects in the memory cache exceeds the class setting memory cache, and path= "Java.io.tmpdir" indicates that the data is written to this directory. The Java.io.tmpdir directory is generated according to relative paths at run time.
<defaultCache> represents the default data expiration policy for setting the cache.
<cache> indicates that a data expiration policy with a specific named cache is set.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.