← ClaudeAtlas

redis-devlisted

Redis 开发与审查助手(Java / Spring Boot)。开发、审查或优化缓存(@Cacheable 声明式 / RedisTemplate 手动)、分布式锁(Redisson / lock4j / SET NX EX / 看门狗)、Redis 连接与配置 (单机 / 哨兵 / 集群 / 连接池)、序列化(key 乱码 / JSON / LocalDateTime)、缓存一致性 (穿透 / 击穿 / 雪崩 / hot key / 先更库再删缓存 / cache aside)、用 Redis 数据结构实现业务功能 (计数器 / 签到 / 去重 / 延迟队列 / UV 统计 / 布隆过滤器 / 限流)、消息与事件(发布订阅 / Pub/Sub / Stream 可靠队列 / 键空间通知 / 过期事件)时使用本技能——无需用户提到 Redis。 次级触发信号——代码或 pom 中出现:spring-boot-starter-data-redis、redisson、RedisTemplate、 @Cacheable / @CacheEvict / @CachePut / @EnableCaching、RLock / RedissonClient / tryLock / @Lock4j / RRateLimiter / RDelayedQueue / RBloomFilter、opsForValue 等 opsFor* 方法、 convertAndSend / RedisMessageListenerContainer / StreamMessageListenerContainer 时必须使用本技能; 用户报错出现:key 乱码(\xac\xed)、序列化 / 反序列化异常、连不上 Redis / command timeout / pool exhausted、@Cacheable 不生效、读回 LinkedHashMap 时必须使用本技能。 不适用于:Sa-Token 等框架自身的会话 / 登录集成、测试容器化 Redis、Redis 服务器安装部署 / 主从搭建 / 监控指标与内存淘汰策略调优(运维范围)、非 Java 语言。
BaixuanZhu/skills · ★ 0 · Data & Documents · score 78
Install: claude install-skill BaixuanZhu/skills
# Redis 开发助手 面向 Java / Spring Boot 的 Redis 编码助手:缓存、分布式锁、Redisson 分布式对象(限流 / 延迟队列 / 布隆过滤器)、序列化配置、连接配置、缓存一致性、消息与事件。 版本基准:**Spring Boot 3.x/4.x(Spring Data Redis 3.x/4.x、Lettuce 6.x/7.x)+ Redisson 3.x(Boot 4 下 starter 用 4.x 线,`references/07-redisson.md` §1)**; Boot 2.7 差异以 `Boot2.x` 标注(主要是 `spring.redis.*` vs `spring.data.redis.*`——Boot 3/4 前缀相同)。 采用**完全本地自包含**策略:所有知识沉淀于本地 `references/`,运行时不依赖任何外部文档站点。 ## 版本与依赖 | 场景 | 依赖 | 说明 | |---|---|---| | 缓存 / 任意 Redis 读写 | `spring-boot-starter-data-redis` | 默认 Lettuce 客户端,自带 | | 声明式缓存 @Cacheable | `spring-boot-starter-data-redis` + `spring-boot-starter-cache` | 还需 `@EnableCaching` | | 分布式锁 / 限流 / 布隆过滤器 / 延迟队列 | `org.redisson:redisson` 手动配置(数据面留在 Lettuce,**默认**);或 `redisson-spring-boot-starter`(整体替换连接层,全新项目 / Redisson 数据面) | 仅缓存场景**不要**引入 | | 连接池(池参数生效) | `org.apache.commons:commons-pool2` | **池实现库,不是 Redis 客户端**;仅配 `lettuce.pool.*` 时需要(普通命令不走池,`references/02-pool.md` §1) | - **配置命名空间**:Boot 3/4 用 `spring.data.redis.*`,Boot 2.x 用 `spring.redis.*`——配错导致连不上(症状见 `references/08-troubleshoot.md`)。 - **redisson-spring-boot-starter 会把 RedisConnectionFactory 替换为 Redisson 实现**(RedisTemplate 底层随之切换),引入即全局生效,详见 `references/07-redisson.md` §1。 ## 第 0 步:依赖探测与激活分支 任务涉及缓存、分布式锁、Redis 配置、序列化、数据结构实现——**即使用户没提 Redis**——先检索项目依赖与代码(pom / build.gradle 搜 `data-redis`、`redisson`、`lock4j`;代码搜 `RedisTemplate`、`@Cacheable`、`RLock`): | 探测结果 | 动作 | |---|---| | 已有 `data-redis` / `redisson` / `lock4j` 依赖,或代码用 `RedisTemplate` / `@Cacheable` / `RLock` | 直接激活,走「关键决策检