Redis:高效的缓存处理

Redis作为现在最流行的缓存技术,把接收到的数据,转换为硬盘数据或者数据库,存储在缓存中,减少多重数据同时的压力,
也可以实现单点,主要作为缓存

1.先分享一些配置pom.xml
<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-redis</artifactId>
</dependency>

<dependency>
    <groupId>redis.clients</groupId>
    <artifactId>jedis</artifactId>
    <version>2.9.0</version>
</dependency>
2.再看一下redis的配置


#### Redis com.oneinlet.config.redisConfig.maxTotal= 30 com.oneinlet.config.redisConfig.maxIdle= 10 com.oneinlet.config.redisConfig.maxWaitMillis= 51000 com.oneinlet.config.redisConfig.minIdle= 5 com.oneinlet.config.redisConfig.port= 6379 com.oneinlet.config.redisConfig.hostName= localhost com.oneinlet.config.redisConfig.password= 123456 com.oneinlet.config.redisConfig.timeout= 15000
3.controller的方法

 
@RequestMapping( "/putValueToRedis/{name}") public Object getRedis( @PathVariable String name) { redisService.setKeyValue(name, "www.520code.net"); return setOKResult(); }
posted @   码海兴辰  阅读(15)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示