spring-cache.xml
2.07 KB
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
<?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-4.1.xsd">
<cache:annotation-driven mode="aspectj" cache-manager="cacheManager" proxy-target-class="true" order="1"/>
<bean id="cacheManager" class="org.springframework.cache.support.CompositeCacheManager">
<property name="cacheManagers">
<list>
<ref bean="local"/>
<ref bean="center"/>
</list>
</property>
<property name="fallbackToNoOpCache" value="true"/>
</bean>
<!--
<bean id="local" class="org.springframework.cache.guava.GuavaCacheManager">
<property name="cacheSpecification" value="maximumSize=2000,concurrencyLevel=2,expireAfterAccess=3600s,expireAfterWrite=72000s" />
<property name="cacheNames">
<list>
<value>ACT</value>
<value>API</value>
<value>RAK</value>
<value>TPL</value>
<value>CNF</value>
</list>
</property>
</bean>
-->
<!--ehcache-->
<bean id="local" class="org.springframework.cache.ehcache.EhCacheCacheManager">
<property name="cacheManager" ref="ehcacheManagerFactory"/>
</bean>
<bean id="ehcacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:cache/ehcache.xml"/>
</bean>
<bean id="center" class="org.springframework.data.redis.cache.RedisCacheManager">
<constructor-arg>
<ref bean="redisTemplate"/>
</constructor-arg>
<property name="cacheNames">
<set>
<value>SIT_API</value>
<value>GZH_API</value>
<value>CST</value>
<value>CPN</value>
<value>EVT</value>
</set>
</property>
<property name="defaultExpiration">
<value>3600</value>
</property>
</bean>
</beans>