HibernateEhcacheJgroups - 基於Annotation的叢集快取配置
一、版本相關
ehcache-jgroupsreplication-1.7.jar
jgroups-3.4.1.Final.jar
ehcache-core-2.6.5.jar
hibernate3.6.10.Final.jar
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配置
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd"
updateCheck="true" monitoring="autodetect" dynamicConfig="true">
<diskStore path="E:/WS/temp/ehcahe" />
<cacheManagerPeerProviderFactory
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;loopback=true;
mcast_send_buf_size=80000;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.min_threads=4;
timer_type=new;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;oob_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.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="::"/>
<defaultCache maxEntriesLocalHeap="10000" eternal="false" overflowToDisk="true"
timeToIdleSeconds="600" timeToLiveSeconds="600" diskPersistent="false">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicateUpdates=true, replicateUpdatesViaCopy=true,
replicateRemovals=true, asynchronousReplicationIntervalMillis=200" />
<bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=50000000"/>
</defaultCache>
<cache name="org.hibernate.cache.StandardQueryCache" maxElementsInMemory="10000"
eternal="false" timeToIdleSeconds="600" timeToLiveSeconds="600" overflowToDisk="true">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,replicateUpdates=true,
replicateUpdatesViaCopy=true,replicateRemovals=true,asynchronousReplicationIntervalMillis=200" />
<bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=50000000"/>
</cache>
<cache name="org.hibernate.cache.UpdateTimestampsCache" maxElementsInMemory="10000" eternal="false"
timeToIdleSeconds="600" timeToLiveSeconds="600" overflowToDisk="true">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,
replicateUpdatesViaCopy=true,replicateRemovals=true,asynchronousReplicationIntervalMillis=200" />
<bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=50000000"/>
</cache>
</ehcache>
三、Hibernate applicationContext.xml配置
<context:component-scan base-package="com.clusterehcache" />
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</prop>
</props>
</property>
<property name="packagesToScan">
<list>
<value>com.clusterehcache.centity</value>
</list>
</property>
</bean>
四、Entity配置@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class User {
……
}
相關文章
- EhCache 分散式快取/快取叢集分散式快取
- B站基於快取最佳化 PRESTO 叢集查詢效能快取REST
- Redis快取高可用叢集Redis快取
- [求助] 關於ehcache叢集快取同步資料的問題快取
- Cacheonix:Java分散式叢集快取框架Java分散式快取框架
- 邊緣叢集場景下的映象快取快取
- 基於Dokcer搭建Redis叢集(主從叢集)Redis
- Spring Boot 2.x基礎教程:使用EhCache快取叢集Spring Boot快取
- OSCache叢集環境下快取同步的問題快取
- 基於 Docker 的 MongoDB 主從叢集DockerMongoDB
- 基於ObjectMapper的本地快取ObjectAPP快取
- 基於Hadoop不同版本搭建hive叢集(附配置檔案)HadoopHive
- 基於kerberos的hadoop安全叢集搭建ROSHadoop
- 基於viper的配置讀取
- LNMP 分散式叢集(四):Memcached 快取伺服器的搭建LNMP分散式快取伺服器
- redis偽叢集配置Cluster叢集模式Redis模式
- Kafka叢集配置Kafka
- mongo 叢集配置Go
- MySQL叢集配置MySql
- 基於 ZooKeeper 搭建 Spark 高可用叢集Spark
- 基於tomcat叢集做session共享TomcatSession
- 基於zookeeper+leveldb搭建activemq叢集MQ
- PC基於Linux的叢集環境搭建?Linux
- 基於linux的叢集系統(二)(轉)Linux
- 基於Annotation註解整合SSH框架和基於XML檔案配置Bean整合SSH框架框架XMLBean
- JAVA中使用最廣泛的本地快取?Ehcache的自信從何而來3 —— 本地快取變身分散式叢集快取,打破本地快取天花板Java快取分散式
- 基於 ZooKeeper 實現爬蟲叢集的監控爬蟲
- 基於 ZooKeeper 搭建 Hadoop 高可用叢集Hadoop
- 基於 Redis3.2.4 叢集搭建說明RedisS3
- JBoss Cache:企業級Java事務快取叢集系統Java快取
- spark叢集的配置檔案Spark
- Docker Elasticsearch 叢集配置DockerElasticsearch
- MySQL叢集配置(轉)MySql
- 基於pacemaker 的高可用叢集架構----1 基礎介紹架構
- http快取與cdn快取配置指南HTTP快取
- Ehcache快取配置快取
- 配置session——快取Session快取
- 配置kuernetes叢集pod拉取私有映象倉庫中的映象