当前位置: 首页 > news >正文

做好网站怎么做app免费拓客软件哪个好用

做好网站怎么做app,免费拓客软件哪个好用,前期的网站建设的难度,中文域名做的网站有哪些问题描述 使用spring-data-redis后,如果应用长达一段时间没访问,新的请求使用redis时,可能会报错:io.lettuce.core.RedisException: java.io.IOException: 远程主机强迫关闭了一个现有的连接 解决方案 修改项目配置 # spring默…

问题描述

使用spring-data-redis后,如果应用长达一段时间没访问,新的请求使用redis时,可能会报错:io.lettuce.core.RedisException: java.io.IOException: 远程主机强迫关闭了一个现有的连接

解决方案

  1. 修改项目配置
# spring默认使用lettuce,详情参见:LettuceConnectionConfiguration
spring.redis.client-type=lettuce
spring.redis.lettuce.pool.minIdle=1
spring.redis.lettuce.pool.maxIdle=8
# 5分钟执行一次
spring.redis.lettuce.pool.timeBetweenEvictionRuns=PT2M
spring.redis.lettuce.pool.enabled=true
spring.redis.lettuce.shutdownTimeout=PT0.1S
  1. 修改redis.conf(可能不用改)
tcp-keepalive 60
  1. 修改LettuceConnectionFactory的shareNativeConnection参数
// 新增一个配置类,在创建RedisTemplate之前,修改LettuceConnectionFactory的shareNativeConnection参数
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "spring.redis.client-type", havingValue = "lettuce", matchIfMissing = true)
public class RedisAutoConfiguration {@Beanpublic RedisTemplate<Object, Object> redisTemplate(LettuceConnectionFactory redisConnectionFactory) {redisConnectionFactory.setShareNativeConnection(false);RedisTemplate<Object, Object> template = new RedisTemplate<>();template.setConnectionFactory(redisConnectionFactory);return template;}@Beanpublic StringRedisTemplate stringRedisTemplate(LettuceConnectionFactory redisConnectionFactory) {redisConnectionFactory.setShareNativeConnection(false);return new StringRedisTemplate(redisConnectionFactory);}
}// LettuceConnectionFactory.java中的源码
// 如果不修改sharedConnection为false, lettuce根本没使用自己配置的连接池
protected StatefulRedisConnection<byte[], byte[]> getSharedConnection() {return shareNativeConnection && !isClusterAware()? (StatefulRedisConnection) getOrCreateSharedConnection().getConnection(): null;
}
public RedisConnection getConnection() {connection = doCreateLettuceConnection(getSharedConnection(), connectionProvider, getTimeout(), getDatabase());
}
http://www.hkea.cn/news/696379/

相关文章:

  • 怎样找到正规代加工网站百度地图3d实景地图
  • 潍坊网站建设公司网站搭建免费
  • 惠州做网站好的公司下载百度语音导航地图安装
  • 春节网站怎么做小说排行榜百度搜索风云榜
  • 商城服务是什么软件seo是指什么岗位
  • 无锡网站建设有限公司网站快速收录的方法
  • 网站建设通报推广网站多少钱
  • 网络推广公司成都seo排名优化教程
  • 一台手机登录微信网页版西安优化外
  • 如何做旅游攻略网站长沙seo优化推荐
  • 长春火车站电话咨询电话快排seo
  • 龙城建设网站公司网站内容优化方法
  • 南通网站建设搭建网站卖链接
  • 驻马店市做网站seo臻系统
  • 找公司做网站怎么图片都要自己找百度推广官网电话
  • 网站小样用什么做seo外链平台热狗
  • 建站点的步骤sem是什么
  • 深圳专业做网站的衡水网站优化推广
  • 徐汇科技网站建设2345中国最好的网址站
  • 邢台论坛吧百度seo收录软件
  • 做国外服务器网站吗怎么让百度搜索靠前
  • 做动态图网站有哪些自建站怎么推广
  • web网站开发课程设计报告seo技术培训沈阳
  • 会宁网站建设公司网站优化助手
  • 网站设计制作体会2023年5月最新疫情
  • 月亮湾设计有限公司网站南宁seo产品优化服务
  • 福田欧曼服务站电话上海高端seo公司
  • 高端网站建设哪家好谷歌seo和百度seo
  • 前端写一个页面多少钱海口网站关键词优化
  • 浦东新区建设局官方网站东莞seo关键词