惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog RSS Feed
人人都是产品经理
人人都是产品经理
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google Online Security Blog
Google Online Security Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
The GitHub Blog
The GitHub Blog
N
News and Events Feed by Topic
Security Archives - TechRepublic
Security Archives - TechRepublic
D
DataBreaches.Net
阮一峰的网络日志
阮一峰的网络日志
H
Heimdal Security Blog
PCI Perspectives
PCI Perspectives
A
About on SuperTechFans
Forbes - Security
Forbes - Security
博客园 - 三生石上(FineUI控件)
博客园_首页
Vercel News
Vercel News
H
Hacker News: Front Page
WordPress大学
WordPress大学
Hacker News: Ask HN
Hacker News: Ask HN
MyScale Blog
MyScale Blog
Recent Announcements
Recent Announcements
N
News | PayPal Newsroom
T
Threatpost
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
SecWiki News
SecWiki News
D
Docker
G
Google Developers Blog
L
LINUX DO - 最新话题
O
OpenAI News
S
Schneier on Security
AI
AI
T
The Exploit Database - CXSecurity.com
S
Security Affairs
I
Intezer
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Latest
Security Latest
博客园 - 司徒正美
Know Your Adversary
Know Your Adversary
爱范儿
爱范儿
T
Troy Hunt's Blog
L
LINUX DO - 热门话题

博客园 - KLAPT

Gateway 网关 CodeX =>Skills SpringBoot 默认配置修改 JWT 续签 Access Token + Refresh Token 双 Token claudeCode 命令 MyBatis 的 Mapper 接口 AI | CC GUI 集成 IDEA 完整教程 在IDEA中使用Claude Code IDEA中使用CodeX MyBatisPlus解决大数据量查询慢问题 idea 中的 claude code Token Dubbo 和 Spring Cloud Gateway的区别 Transactional 注解中propagation 掌握 Spring 框架这 10 个扩展点 SpringBoot 快速实现 api 加密 Spring Boot/Cloud 中 bootstrap.yml 与 application.yml SpringBoot 实现 DOCX 转 PDF 微服务Token鉴权设计的几种方案 进程、线程、协程 RSA 加密 Java二维码 ntp服务端和客户端 Chronyd与NTP chronyd 作为服务器时钟 chrony sudo命令和su 的区别 java -cp 和 java -jar Maven 项目打包:实现业务代码与第三方依赖分离 达梦数据库创建用户 梦数据库新增大字段报错问题 达梦数据库操作 MySQL UPDATE多表关联更新 达梦数据库 为HTTP POST请求设置请求体 在Java中调用第三方接口并返回第三方页面 Java调用第三方接口的方法 Nginx 之Rewrite 使用详解 linux 命令 Spring Boot项目中集成Spring Security OAuth2和Apache Shiro
Redis 内存满了怎么处理
KLAPT · 2026-07-01 · via 博客园 - KLAPT

命令:

redis-cli info memory  ==》

info命令可以显示redis服务器的许多信息,包括服务器基本信息、CPU、内存、持久化、客户端连接信息等
等;memory是参数,表示只显示内存相关的信息。


redis-cli config get maxmemory===》看有没有上限
redis-cli config get maxmemory-policy====》淘汰策略
redis-cli --bigkeys================》edis 内存分布,扫 big key

=======淘汰策略===========================

maxmemory-policy noeviction

那内存满了之后,写命令直接报错。读没事,写不进去。

如果是:

maxmemory-policy allkeys-lru

Redis 会从所有 key 里找最近较少使用的淘汰。

如果是:

maxmemory-policy volatile-lru

只会从设置了过期时间的 key 里淘汰。没 TTL 的 key,它不动。

big key。

Redis 内存满,不一定是 key 数量多,也可能是几个大 key 把内存打穿。比如有人把用户几千条消息一次性塞进一个 List,或者把全量商品 JSON 塞成一个 String。

=====================限制redis的大小=================================
public boolean putCacheJson(String key, String json, Duration ttl) {
    if (key == null || json == null) {
        returnfalse;
    }

    int bytes = json.getBytes(StandardCharsets.UTF_8).length;
    if (bytes > 256 * 1024) {
        log.warn("skip large redis value, key={}, size={}KB", key, bytes / 1024);
        returnfalse;
    }

    redisTemplate.opsForValue().set(key, json, ttl);
    returntrue;
}