Ehcache. xml distribution test cache and ehcache. xml Cache
1 <? Xml version = "1.0" encoding = "gbk"?> 2 <ehcache xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: noNamespaceSchemaLocation = "ehcache. xsd"> 3 <! -- Cache is set to disk cache to prevent the app from logging on again when tomcat is restarted --> 4 <diskStore path = "java. io. tmpdir"/> 5 <! -- Cache 6 in multiple servers in the cluster. Note that the RMI communication socket ports of each server to be synchronized to the cache are different. Pay attention to settings when configuring --> 7 <cacheManagerPeerListenerFactory class = "net. sf. ehcache. distribution. RMICacheManagerPeerListenerFactory "8 properties =" hostName = 10.1.35.111, port = 40001, socketTimeoutMillis = 2000 "/> 9 <! ----> 10 <cacheManagerPeerProviderFactory 11 class = "net. sf. ehcache. distribution. export "12 properties =" peerDiscovery = manual, 13 hostName = 10.1.35.111, 14 port = 40002,15 rmiUrls = // 10.1.35.111: 40001/BaseDataCache | // 10.1.35.111: 40002/BaseDataCache, 16 timeToLive = 0 "17/> 18 <! -- 19 <cacheManagerPeerProviderFactory 20 class = "net. sf. ehcache. distribution. RMICacheManagerPeerProviderFactory "21 properties =" peerDiscovery = automatic, multicastGroupAddress = 230.0.0.1, 22 multicastGroupPort = 4446, timeToLive = 32 "/> 23 --> 24 <! -- 25 search for cache on a certain network segment: timeToLive26 0 is restricted to the same server, 1 is restricted to the same subnet, and 32 is restricted to the same website 27, 64 is restricted to the same region, 128 is restricted to the same continent, 255 is not restricted --> 28 29 <defaultCache maxElementsInMemory = "10000" eternal = "false" timeToIdleSeconds = "600" timeToLiveSeconds = "86400" overflowToDisk = "false"/> 30 <! -- 31 configure custom cache 32 maxElementsInMemory: Maximum number of objects allowed to be created in the cache 33 eternal: whether the objects in the cache are permanent. If yes, the timeout setting will be ignored, the object never expires. 34. timeToIdleSeconds: the cache data passivation time, that is, the maximum time interval between the two access times of 35 before an element disappears. This is only valid when the element is not permanently resident, 36 if the value is 0, it means that the element can pause for an infinite period of time. 37 timeToLiveSeconds: The survival time of the cached data, that is, the maximum time interval between an element construction and extinction. 38 This is only valid when the element is not permanently resident, if the value is 0, it means that the element can pause for an infinite period of time. 39 overflowToDisk: whether to enable disk cache when the memory is insufficient. 40 memoryStoreEvictionPolicy: The elimination algorithm after the cache is full. 41 --> 42 <cache name = "BaseDataCache" 43 maxElementsInMemory = "10000" 44 eternal = "false" 45 overflowToDisk = "true" 46 timeToIdleSeconds = "60000" 47 timeToLiveSeconds = "600000 "48 memoryStoreEvictionPolicy =" LFU "> 49 <! -- 50 RMI cache distribution synchronous Search class Using net. sf. ehcache. distribution. the factory RMICacheReplicatorFactory51 supports the following attributes: 52 replicatePuts = true | false-whether to copy a new element to another peers when it is added to the cache. The default value is true. 53 replicateUpdates = true | false-whether to copy an existing element in the cache when it is overwritten. The default value is true. 54 replicateRemovals = true | false-whether to copy the removed element. The default value is true. 55 replicateAsynchronously = true | false-whether the replication mode is asynchronous or synchronous when it is set to true or false. The default value is true. 56 replicatePutsViaCopy = true | false-if a new element is copied to another cache and is specified as true, the default value is true. 57 replicateUpdatesViaCopy = true | false-if an element is copied to another cache and is specified as true, the default value is true. 58 asynchronousReplicationIntervalMillis = 100059 --> 60 <! -- Listen to the RMI synchronization cache object configuration and register the corresponding cache listening class for processing cache events, such as put, remove, update, and expire --> 61 <cacheEventListenerFactory62 class = "net. sf. ehcache. distribution. required "63 properties =" replicateAsynchronously = true, 64 replicatePuts = true, 65 replicatePutsViaCopy = true, 66 replicateUpdates = true, 67 replicateUpdatesViaCopy = true, 68 replicateRemovals = true "/> 69 </cache> 70 71 </ehcache>