一.背景 项目中使用spring框架整合redis,使用框架封装的RedisTemplate来实现数据的增删改查,项目上线后,我发现运行一段时间后,会出现异常Could not get a resource from the pool.起初我是觉得redis的最大连接数不够,所以一味地增大最大连接数,试了几次,发现还是报异常:Could not get a resource from the pool.但是看到连接池中明显有链接,况且此问题一般是资源池的连接数大于设置的最大连接数才出现.最后怀疑…
现在越来越多的地方需要非关系型数据库了,最近网站优化,当然从页面到服务器做了相应的优化后,通过在线网站测试工具与之前没优化对比,发现有显著提升. 服务器优化目前主要优化tomcat,在tomcat目录下的server.xml文件配置如下内容: <Connector port="1818" protocol="HTTP/1.1" maxHttpHeaderSize="8192" maxThreads="1000" minS…
几种JSON框架用法和效率对比: https://blog.csdn.net/sisyphus_z/article/details/53333925 https://blog.csdn.net/weixin_42476601/article/details/81700981 https://blog.csdn.net/xuSir_1/article/details/72461364 https://www.cnblogs.com/cdf-opensource-007/p/6395458.html…
1.pom.xml文件 <dependencies> <!-- spring核心包 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>4.1.7.RELEASE</version> </dependency> <!-- sprin…
我在Spring整合Redis时报错,我是犯了一个很低级的错误! 我设置了Redis的访问密码,在Spring的配置文件却没有配置密码这一项,配置上密码后,终于不报错了!…
Redis的下载与安装 在Linux上使用wget http://download.redis.io/releases/redis-5.0.0.tar.gz下载源码到指定位置 解压:tar -xvf redis-5.0.0.tar.gz cd redis-5.0.0.tar.gz make:编译(如果Linux上没有装gcc编译环境,则执行yum -y install gcc-c++) make install:把Redis的cli和server添加到bin中,相当于配置环境变量 vim red…
打开redis服务的配置文件   添加notify-keyspace-events Ex  如果是注释了,就取消注释 这个是在以下基础上进行添加的 Spring整合redis:https://www.cnblogs.com/pxblog/p/12583703.html 在redis-context.xml 配置文件里增加 <!--设置key过期事件监听--> <bean id="redisMessageListenerContainer" class="or…
JAVA整合Redis使用redisTemplate清除库中的所有键值对数据,清除所有缓存数据 Set<String> keys = redisTemplate.keys("*"); redisTemplate.delete(keys);…
本文使用的是spring-data-redis 首先说下redis最简单得使用,除去配置. 需要在你要使用得缓存得地方,例如mybatis在mapper.xml中加入: <cache eviction="LRU" type="cn.jbit.cache.RedisCache"/> 由于是第一次使用redis,再调试代码得时候报错:Cannot get Jedis connection; nested exception is redis.clients.…
超时 Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: Read timed out at redis.clients.jedis.Protocol.process(Protocol.java:79) at redis.clients.jedis.Protocol.read(Protocol.java:1…