|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
xmlns:p="http://www.springframework.org/schema/p"
|
|
|
xmlns="http://www.springframework.org/schema/beans"
|
|
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
|
|
|
|
<!-- redis template definition -->
|
|
|
<bean id="stringRedisSerializer"
|
|
|
class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
|
|
|
|
|
|
<!-- pool config -->
|
|
|
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
|
|
|
<property name="maxTotal" value="${redis.pool.maxTotal:50}" />
|
|
|
<property name="maxIdle" value="${redis.pool.maxIdle:20}" />
|
|
|
<property name="minIdle" value="${redis.pool.minIdle:20}"></property>
|
|
|
<property name="maxWaitMillis" value="${redis.pool.maxWaitMillis:2000}" />
|
|
|
<property name="testOnBorrow" value="${redis.pool.testOnBorrow:false}" />
|
|
|
<property name="testWhileIdle" value="${redis.pool.testWhileIdle:false}"></property>
|
|
|
</bean>
|
|
|
|
|
|
|
|
|
<!-- 只读 -->
|
|
|
<bean id="yhJedisConnectionFactoryReadOnly" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
|
|
|
p:poolConfig-ref="jedisPoolConfig"
|
|
|
p:hostName="${redis.union.readonly.proxy.address}"
|
|
|
p:port="${redis.union.readonly.proxy.port}"
|
|
|
p:password="${redis.union.readonly.proxy.auth}"
|
|
|
p:database="${redis.union.readonly.proxy.database:0}" primary="true" />
|
|
|
|
|
|
<bean id="yhRedisTemplateReadOnly"
|
|
|
class="com.yoho.unions.common.redis.YHRedisTemplate" primary="false"
|
|
|
p:connectionFactory-ref="yhJedisConnectionFactoryReadOnly"
|
|
|
p:keySerializer-ref="stringRedisSerializer"
|
|
|
p:valueSerializer-ref="stringRedisSerializer"/>
|
|
|
|
|
|
|
|
|
<!-- 读写 -->
|
|
|
<bean id="yhJedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
|
|
|
p:poolConfig-ref="jedisPoolConfig"
|
|
|
p:hostName="${redis.union.proxy.address}"
|
|
|
p:port="${redis.union.proxy.port}"
|
|
|
p:password="${redis.union.proxy.auth}"
|
|
|
p:database="${redis.proxy.database:0}" primary="true" />
|
|
|
|
|
|
<bean id="yhRedisTemplate"
|
|
|
class="com.yoho.unions.common.redis.YHRedisTemplate" primary="true"
|
|
|
p:connectionFactory-ref="yhJedisConnectionFactory"
|
|
|
p:keySerializer-ref="stringRedisSerializer"
|
|
|
p:valueSerializer-ref="stringRedisSerializer"/>
|
|
|
|
|
|
<bean id="yhValueOperations" class="com.yoho.unions.common.redis.YHValueOperations"/>
|
|
|
<bean id="yhListOperations" class="com.yoho.unions.common.redis.YHListOperations"/>
|
|
|
|
|
|
</beans> |
|
|
\ No newline at end of file |