1
|
-<?xml version="1.0" encoding="UTF-8"?>
|
|
|
2
|
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
3
|
- xmlns:p="http://www.springframework.org/schema/p"
|
|
|
4
|
- xmlns="http://www.springframework.org/schema/beans"
|
|
|
5
|
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
|
6
|
-
|
|
|
7
|
- <!-- redis template definition -->
|
|
|
8
|
- <bean id="stringRedisSerializer"
|
|
|
9
|
- class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
|
|
|
10
|
-
|
|
|
11
|
- <!-- pool config -->
|
|
|
12
|
- <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
|
|
|
13
|
- <property name="maxTotal" value="${redis.pool.maxTotal:50}" />
|
|
|
14
|
- <property name="maxIdle" value="${redis.pool.maxIdle:20}" />
|
|
|
15
|
- <property name="minIdle" value="${redis.pool.minIdle:20}"></property>
|
|
|
16
|
- <property name="maxWaitMillis" value="${redis.pool.maxWaitMillis:2000}" />
|
|
|
17
|
- <property name="testOnBorrow" value="${redis.pool.testOnBorrow:false}" />
|
|
|
18
|
- <property name="testWhileIdle" value="${redis.pool.testWhileIdle:false}"></property>
|
|
|
19
|
- </bean>
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
- <!-- 只读 -->
|
|
|
23
|
- <bean id="yhJedisConnectionFactoryReadOnly" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
|
|
|
24
|
- p:poolConfig-ref="jedisPoolConfig"
|
|
|
25
|
- p:hostName="${redis.union.readonly.proxy.address}"
|
|
|
26
|
- p:port="${redis.union.readonly.proxy.port}"
|
|
|
27
|
- p:password="${redis.union.readonly.proxy.auth}"
|
|
|
28
|
- p:database="${redis.union.readonly.proxy.database:0}" primary="true" />
|
|
|
29
|
-
|
|
|
30
|
- <bean id="yhRedisTemplateReadOnly"
|
|
|
31
|
- class="com.yoho.unions.common.redis.YHRedisTemplate" primary="false"
|
|
|
32
|
- p:connectionFactory-ref="yhJedisConnectionFactoryReadOnly"
|
|
|
33
|
- p:keySerializer-ref="stringRedisSerializer"
|
|
|
34
|
- p:valueSerializer-ref="stringRedisSerializer"/>
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
- <!-- 读写 -->
|
|
|
38
|
- <bean id="yhJedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
|
|
|
39
|
- p:poolConfig-ref="jedisPoolConfig"
|
|
|
40
|
- p:hostName="${redis.union.proxy.address}"
|
|
|
41
|
- p:port="${redis.union.proxy.port}"
|
|
|
42
|
- p:password="${redis.union.proxy.auth}"
|
|
|
43
|
- p:database="${redis.proxy.database:0}" primary="true" />
|
|
|
44
|
-
|
|
|
45
|
- <bean id="yhRedisTemplate"
|
|
|
46
|
- class="com.yoho.unions.common.redis.YHRedisTemplate" primary="true"
|
|
|
47
|
- p:connectionFactory-ref="yhJedisConnectionFactory"
|
|
|
48
|
- p:keySerializer-ref="stringRedisSerializer"
|
|
|
49
|
- p:valueSerializer-ref="stringRedisSerializer"/>
|
|
|
50
|
-
|
|
|
51
|
- <bean id="yhValueOperations" class="com.yoho.unions.common.redis.YHValueOperations"/>
|
|
|
52
|
- <bean id="yhListOperations" class="com.yoho.unions.common.redis.YHListOperations"/>
|
|
|
53
|
-
|
|
|
54
|
-</beans> |
|
|