Sfoglia il codice sorgente

ehcache和redis配置文件移到独立运行模块下,不共享配置

shuzheng 9 anni fa
parent
commit
87ece3e3e4

+ 0 - 0
zheng-upms/zheng-upms-dao/src/main/resources/applicationContext-ehcache.xml → zheng-upms/zheng-upms-rpc-service/src/main/resources/applicationContext-ehcache.xml


+ 25 - 0
zheng-upms/zheng-upms-rpc-service/src/main/resources/ehcache.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ehcache>
+    <diskStore path="java.io.tmpdir/zheng-upms-rpc-service/ehcache"/>
+    <defaultCache
+            maxElementsInMemory="10000"
+            eternal="false"
+            timeToIdleSeconds="120"
+            timeToLiveSeconds="120"
+            maxElementsOnDisk="10000000"
+            diskExpiryThreadIntervalSeconds="120"
+            memoryStoreEvictionPolicy="LRU">
+        <persistence strategy="localTempSwap"/>
+    </defaultCache>
+    <cache
+            name="zheng-upms-rpc-service-ehcache"
+            eternal="false"
+            timeToIdleSeconds="120"
+            timeToLiveSeconds="300"
+            maxEntriesLocalHeap="10000"
+            maxEntriesLocalDisk="10000000"
+            diskExpiryThreadIntervalSeconds="120"
+            memoryStoreEvictionPolicy="LRU">
+        <persistence strategy="localTempSwap"/>
+    </cache>
+</ehcache>

+ 0 - 0
zheng-upms/zheng-upms-dao/src/main/resources/redis.properties → zheng-upms/zheng-upms-rpc-service/src/main/resources/redis.properties


+ 25 - 0
zheng-upms/zheng-upms-server/src/main/resources/applicationContext-ehcache.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:cache="http://www.springframework.org/schema/cache"
+	xsi:schemaLocation="
+          http://www.springframework.org/schema/beans
+          http://www.springframework.org/schema/beans/spring-beans.xsd
+		  http://www.springframework.org/schema/cache
+          http://www.springframework.org/schema/cache/spring-cache.xsd">
+
+	<!-- 支持缓存注解 -->
+	<cache:annotation-driven cache-manager="cacheManager" />
+
+	<!-- 默认是cacheManager -->
+	<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
+		<property name="cacheManager"  ref="cacheManagerFactory"/>
+	</bean>
+
+	<!-- cache管理器配置 -->
+	<bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
+		<property name="configLocation"  value="classpath:ehcache.xml"/>
+		<property name="shared" value="true" />
+	</bean>
+
+</beans>

+ 2 - 2
zheng-upms/zheng-upms-dao/src/main/resources/ehcache.xml → zheng-upms/zheng-upms-server/src/main/resources/ehcache.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <ehcache>
 <ehcache>
-    <diskStore path="java.io.tmpdir/zheng-upms-dao/ehcache"/>
+    <diskStore path="java.io.tmpdir/zheng-upms-server/ehcache"/>
     <defaultCache
     <defaultCache
             maxElementsInMemory="10000"
             maxElementsInMemory="10000"
             eternal="false"
             eternal="false"
@@ -12,7 +12,7 @@
         <persistence strategy="localTempSwap"/>
         <persistence strategy="localTempSwap"/>
     </defaultCache>
     </defaultCache>
     <cache
     <cache
-            name="zheng-upms-ehcache"
+            name="zheng-upms-server-ehcache"
             eternal="false"
             eternal="false"
             timeToIdleSeconds="120"
             timeToIdleSeconds="120"
             timeToLiveSeconds="300"
             timeToLiveSeconds="300"

+ 7 - 0
zheng-upms/zheng-upms-server/src/main/resources/redis.properties

@@ -0,0 +1,7 @@
+master.redis.ip=127.0.0.1
+master.redis.port=6379
+master.redis.password=FNFl9F2O2Skb8yoKM0jhHA==
+master.redis.max_active=500
+master.redis.max_idle=5
+master.redis.max_wait=10000
+master.redis.timeout=10000