一、版本相关
ehcache-jgroupsreplication-1.7.jar
jgroups-3.4.1.Final.jar
ehcache-core-2.6.5.jar
hibernate3.6.10.Final.jar
二、EhCache ehcache.xml配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
xsi:noNamespaceSchemaLocation="ehcache.xsd"updateCheck="true"
monitoring="autodetect"dynamicConfig="true">
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
properties="connect=UDP(mcast_addr=230.0.0.1;mcast_port=45566;tos=32;mcast_recv_buf_size=120000;mcast_send_buf_size=80000;
loopback=true;discard_incompatible_packets=true;max_bundle_size=64K;max_bundle_timeout=30;
ip_ttl=32;enable_bundling=true;enable_diagnostics=true;thread_naming_pattern=cl;
timer_type=new;timer.min_threads=4;timer.max_threads=10;timer.keep_alive_time=3000;timer.queue_max_size=500;
thread_pool.enabled=true;thread_pool.min_threads=2;thread_pool.max_threads=8;thread_pool.keep_alive_time=5000;
thread_pool.queue_enabled=true;thread_pool.queue_max_size=10000;thread_pool.rejection_policy=discard;oob_thread_pool.enabled=true;
oob_thread_pool.min_threads=1;oob_thread_pool.max_threads=8;oob_thread_pool.keep_alive_time=5000;
oob_thread_pool.queue_enabled=false;oob_thread_pool.queue_max_size=100;oob_thread_pool.rejection_policy=Run):
PING(timeout=2000;num_initial_members=6):
MERGE2(min_interval=5000;max_interval=10000):
VERIFY_SUSPECT(timeout=1500):
pbcast.NAKACK(use_mcast_xmit=true;discard_delivered_msgs=true;retransmit_timeout=1200):
UNICAST(timeout=1200):
pbcast.STABLE(desired_avg_gossip=20000;stability_delay=1000;max_bytes=4M):
pbcast.GMS(print_local_addr=true;join_timeout=3000;view_bundling=true):
FRAG2(frag_size=60K)"
propertySeparator="::"/>
timeToIdleSeconds="600"timeToLiveSeconds="600"overflowToDisk="true"
diskPersistent="false">
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicateUpdates=true,replicateUpdatesViaCopy=true,
replicateRemovals=true,asynchronousReplicationIntervalMillis=200" />
properties="bootstrapAsynchronously=true,maximumChunkSizeBytes=50000000"/>
maxElementsInMemory="10000"eternal="false"timeToIdleSeconds="600"
timeToLiveSeconds="600"overflowToDisk="true">
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicateUpdates=true,replicateUpdatesViaCopy=true,
replicateRemovals=true,asynchronousReplicationIntervalMillis=200" />
class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=50000000"/>
maxElementsInMemory="10000"eternal="false"timeToIdleSeconds="600"
timeToLiveSeconds="600"overflowToDisk="true">
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicateUpdates=true,replicateUpdatesViaCopy=true,
replicateRemovals=true,asynchronousReplicationIntervalMillis=200" />
class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=50000000"/>
三、Hibernate applicationContext.xml配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
org.hibernate.dialect.Oracle9Dialect
true
true
true
true
net.sf.ehcache.hibernate.EhCacheRegionFactory
com.clusterehcache.centity
四、Entity配置
1
2
3
4
5
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
publicclassUser {
……
}