引入redis
parent
0b8a64a914
commit
f39a67c46e
|
@ -1,20 +0,0 @@
|
|||
#IP
|
||||
redis.host=127.0.0.1
|
||||
#\u7AEF\u53E3
|
||||
redis.port=6379
|
||||
#\u5BC6\u7801
|
||||
redis.password=
|
||||
#\u8D85\u65F6\uFF0C\u5355\u4F4D\u6BEB\u79D2
|
||||
redis.timeout=10000
|
||||
#\u6700\u5927\u7A7A\u95F2\u6570
|
||||
redis.maxIdle=300
|
||||
#\u6700\u5927\u8FDE\u63A5\u6570
|
||||
redis.maxTotal=600
|
||||
#\u6700\u5927\u7A7A\u95F2\u6570
|
||||
redis.minIdle=1
|
||||
#\u6700\u5927\u5EFA\u7ACB\u8FDE\u63A5\u7B49\u5F85\u65F6\u95F4
|
||||
redis.maxWait=1000
|
||||
#\u6307\u660E\u662F\u5426\u5728\u4ECE\u6C60\u4E2D\u53D6\u51FA\u8FDE\u63A5\u524D\u8FDB\u884C\u68C0\u9A8C,\u5982\u679C\u68C0\u9A8C\u5931\u8D25,\u5219\u4ECE\u6C60\u4E2D\u53BB\u9664\u8FDE\u63A5\u5E76\u5C1D\u8BD5\u53D6\u51FA\u53E6\u4E00\u4E2A
|
||||
redis.testOnBorrow=false
|
||||
#\u4F7F\u7528redis\u5757\u5206\u533A,0-15
|
||||
redis.database=0
|
|
@ -1,45 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xmlns:cache="http://www.springframework.org/schema/cache"
|
||||
xmlns:cache="http://www.springframework.org/schema/cache"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:redis="http://www.springframework.org/schema/redis"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.1.xsd
|
||||
http://www.springframework.org/schema/cache
|
||||
http://www.springframework.org/schema/cache
|
||||
http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
|
||||
http://www.springframework.org/schema/redis
|
||||
http://www.springframework.org/schema/redis/spring-redis-1.0.xsd">
|
||||
<context:property-placeholder location="classpath:redis.properties" ignore-unresolvable="true"/>
|
||||
|
||||
|
||||
<!-- jedis 配置 -->
|
||||
<bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
|
||||
<!-- 最大空闲连接数 -->
|
||||
<property name="maxIdle" value="${redis.maxIdle}" />
|
||||
<property name="maxIdle" value="1" />
|
||||
<!-- 最小空闲连接数 -->
|
||||
<property name="minIdle" value="${redis.minIdle}" />
|
||||
<property name="maxWaitMillis" value="${redis.maxWait}" />
|
||||
<property name="minIdle" value="100" />
|
||||
<property name="maxWaitMillis" value="1000" />
|
||||
<!-- 在获取连接的时候检查有效性 -->
|
||||
<property name="testOnBorrow" value="${redis.testOnBorrow}" />
|
||||
<property name="testOnBorrow" value="false" />
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- redis服务器中心 -->
|
||||
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
|
||||
<property name="poolConfig" ref="poolConfig" />
|
||||
<property name="port" value="${redis.port}" />
|
||||
<property name="hostName" value="${redis.host}" />
|
||||
<property name="password" value="${redis.password}" />
|
||||
<property name="timeout" value="${redis.timeout}" />
|
||||
<property name="database" value="${redis.database}" />
|
||||
<property name="port" value="6379" />
|
||||
<property name="hostName" value="127.0.0.1" />
|
||||
<property name="password" value="" />
|
||||
<property name="timeout" value="10000" />
|
||||
<property name="database" value="0" />
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- redis操作模板,面向对象的模板 -->
|
||||
<bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
|
||||
<property name="connectionFactory" ref="redisConnectionFactory" />
|
||||
<bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
|
||||
<property name="connectionFactory" ref="redisConnectionFactory" />
|
||||
<!-- 将key和value序列化后存入redis,读取时再进行反序列化 -->
|
||||
<!-- 对key的默认序列化器 -->
|
||||
<property name="keySerializer">
|
||||
|
@ -58,5 +58,5 @@
|
|||
<bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
</beans>
|
||||
|
|
|
@ -160,6 +160,6 @@
|
|||
<import resource="classpath*:org/jeecgframework/web/cgform/common/spring-mvc-cgform.xml" />
|
||||
<!-- jeecg plugin dev -->
|
||||
<import resource="classpath:config/spring-config-p3.xml" />
|
||||
<!-- <import resource="classpath:redis.xml" />-->
|
||||
<import resource="classpath:redis.xml" />
|
||||
|
||||
</beans>
|
||||
|
|
Loading…
Reference in New Issue