以下是我的jedis池配置:
Excess of connections are created as the existing ones are not used. What is the purpose of pool if every function creates new connection.
Please let me know if anybody can provide solution to this.
答案 0 :(得分:0)
`<bean id="jedisConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="whenExhaustedAction" value="2" />
<property name="maxIdle" value="40" />
<property name="minIdle" value="30" />
<property name="softMinEvictableIdleTimeMillis" value="60000" />
<property name="timeBetweenEvictionRunsMillis" value="600000" />
</bean>
<bean id="jedisFactoryPrimary"
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="poolConfig"><ref bean="jedisConfig"/></property>
<property name="hostName" value="${redis-db.hostname}"></property>
<property name="password" value="${redis-db.password}"></property>
<property name="port" value="${redis-db.port}"></property>
</bean>`