打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Spring-EhCache学习记录
 
 Spring 注解缓存--聚合Cache
org.springframework.cache.support.CompositeCacheManager

Spring-xml配置
<cache:annotation-driven cache-manager="cacheManager"/>
<bean id="cacheManager" class="org.springframework.cache.support.CompositeCacheManager">  
    <property name="cacheManagers">  
         <list>  
             <ref bean="ehcacheManager"/>  
             <ref bean="redisCacheManager"/>  
         </list>  
</property>  
<property name="fallbackToNoOpCache" value="true"/>  
</bean>
<bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">  
        <property name="configLocation" value="classpath:config/echcache/ehcache.xml"/>  
    </bean>  
    <bean id="ehcacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">  
        <property name="cacheManager" ref="cacheManagerFactory"/>
    </bean>

EhCache分布式缓存配置
RMI方式

Jgroups 单播-多播
本地多播多台机器测试没有问题,但是上生产环境报错(通过其他方式解决)

XML配置
 
 

Jgroups需要添加jar
<!-- jgroups stard-->
<dependency>
     <groupId>org.jgroups</groupId>
     <artifactId>jgroups</artifactId>
     <version>3.6.4</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-jgroupsreplication</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.7.4</version>
</dependency>
<!-- jgroups end-->


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
spring-boot(六)缓存配置
java ssh maven pom文件
JAVA 中 Redis与ehcache对比与使用
SpringBoot缓存技术
SpringBoot中引入Ehcache3.x
Integrating Spring and EHCache
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服