Ehcache Cache Configuration Description

Source: Internet
Author: User

The previous array with Ehcache do cache cluster, now the end, so sorted out the comments of the configuration file, some of their own translation, English proficiency is poor, only for reference.

<cachemanagerpeerproviderfactory
Class= "Net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
Properties= "Connect=tcp (start_port=7800):
Tcpping (initial_hosts=127.0.0.1[7800];p ort_range=10;timeout=3000;num_initial_members=3;up_thread=true;down_ Thread=true):
Verify_suspect (Timeout=1500;down_thread=false;up_thread=false):
Pbcast. Nakack (down_thread=true;up_thread=true;gc_lag=100;retransmit_timeout=3000):
Pbcast. GMS (join_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=false;down_thread=true;up_thread= True) "
Propertyseparator= "::"
/>

Cachemanagerpeerproviderfactory Ehcache Cache Monitor.
Connect=tcp monitoring mode: TCP mode (and UDP mode).
START_PORT Specifies the listening start port.
Tcpping listening ports look for broadcasts (there is another: Tcpgossip) looking for ports for listening, incrementing from Start_port Port_range looking for available ports.
initial_hosts Specifies the host IP of the Ehcache (if there are multiple hosts initial_hosts=192.168.1.1[7800],192.168.1.2[7800]).
Port_range increment value.
Timeout did not find a description, guess is to find the next effective port of residence time.
Num_initial_members initial member, number of items performing cache synchronization
Up_thread,down_thread Each communication protocol generates two threads (Up_thread,down_thread) to control the suspension and operation of the queue by setting the up_thread=false;down_thread= False to invalidate these two threads
Verify_suspect Verification Module (when the problem occurs, the service dies or the communication interface fails)
Gc_lag Garbage Collection Interval
Retransmit_timeout time to wait before broadcasting again
Pbcast. Nakack ensure that the message is broadcast properly and that if the broadcast fails, the receiver will request it again, while ensuring that the message is advanced first in principle
Pbcast. GMS Scheduler, real-time broadcast, informing members of changes, additions or removal.
Join_timeout Join Time Limited
Join_retry_timeout Retry Join limit
Shun automatically try to join (the new version has been removed and is not in favor of use)
PRINT_LOCAL_ADDR print out the address of the current broadcast
================================================================================
<cacheeventlistenerfactory
Class= "Net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
Properties= "Replicateasynchronously=true, Replicateputs=true,
Replicateupdates=true, Replicateupdatesviacopy=false,
Replicateremovals=true "/>

Cacheeventlistenerfactory registers the corresponding cache listener class for handling cache events.
replicateasynchronously whether the True|false copy operation is asynchronous (ture) or synchronous (FALSE) The default value is true.
Replicateputs True|false When the new object is put into the cache, the other caches in the cluster are also put in, and the default is true.
Replicateupdates True|false New Object overwrites whether an object with the same key already exists is replicated, and the default value is true.
Replicateupdatesviacopy True|false replicate the updated objects directly to other caches in the cluster (true); Do not copy objects, just want to set the other of the masses

The cache publishes a message (false) for an object update, and defaults to true.
The Replicateremovals True|false object is removed, and the state is replicated to other caches in the cluster, by default true.

================================================================================

<defaultcache maxelementsinmemory= "500000" eternal= "false"
 timetoidleseconds= "1800" timetoliveseconds= "1800"
 overflowtodisk= "true" diskpersistent= "true"
 < Cacheeventlistenerfactory
  class= " Net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory "
  properties=" Replicateasynchronously=true, Replicateputs=true,
  replicateupdates=true, replicateUpdatesViaCopy= False,
  replicateremovals=true/>
</defaultCache>

 <defaultcache maxelementsinmemory= "10000" eternal= "false"
  timetoidleseconds= "120" timetoliveseconds= "overflowtodisk=" "true"
  diskspoolbuffersizemb= "maxelementsondisk=" 10000000 "
  diskpersistent=" false "diskexpirythreadintervalseconds="
   Memorystoreevictionpolicy= "LRU"
   <cacheeventlistenerfactory
    class= "Net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
   properties= " Replicateasynchronously=true, Replicateputs=true,
   replicateupdates=true, Replicateupdatesviacopy=false,
   replicateremovals=true "/>
 </defaultcache >

Defaultcache default caching, some cached objects that are not configured will use the default cache
Maxelementsinmemory the maximum number of cached objects in memory. When the maximum number of objects is exceeded, Ehcache cleans the memory according to the specified policy
The eternal cache object is permanently valid, and the timeout will not work if one is set.
Timetoidleseconds sets the allowable idle time for an element before it expires. If the element is not permanent, the optional attribute, the default value is 0, which means that the idle time can be infinite.
Timetoliveseconds timetoliveseconds: Sets the element to allow survival time before it expires. The maximum time between the creation time and the expiration time. Used only if the element is not permanently valid, the default is 0. That is, element survival time is infinitely large.
Overflowtodisk configures this property, Ehcache writes element to disk when the number of element in memory reaches Maxelementsinmemory.
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.
The maximum number of cached objects in the Maxelementsondisk disk, if 0 represents infinity.
Diskpersistent whether the cached data on the disk is known when the service is restarted. True does not clear.
Diskexpirythreadintervalseconds disk expiration thread run interval.
Memorystoreevictionpolicy 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).
Note: Common cache is the same as Defaultcache properties, can be configured according to their actual needs

Reference http://ehcache.org/documentation/configuration.html (bottom)

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.