gpt4 book ai didi

redis - 创建的 Redis 连接过多,未使用空闲连接

转载 作者:可可西里 更新时间:2023-11-01 11:42:27 27 4
gpt4 key购买 nike

以下是我的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.

最佳答案

  `<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>`

关于redis - 创建的 Redis 连接过多,未使用空闲连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23288760/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com