فهرست منبع

zheng-cms-rpc-service增加ehcache和redis配置

shuzheng 9 سال پیش
والد
کامیت
5ec0f3cf04

+ 25 - 0
zheng-cms/zheng-cms-rpc-service/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>

+ 25 - 0
zheng-cms/zheng-cms-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-cms-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-cms-rpc-service-ehcache"
+            eternal="false"
+            timeToIdleSeconds="120"
+            timeToLiveSeconds="300"
+            maxEntriesLocalHeap="10000"
+            maxEntriesLocalDisk="10000000"
+            diskExpiryThreadIntervalSeconds="120"
+            memoryStoreEvictionPolicy="LRU">
+        <persistence strategy="localTempSwap"/>
+    </cache>
+</ehcache>

+ 7 - 0
zheng-cms/zheng-cms-rpc-service/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