spring-data-redis

Featured

Use when implementing caching, session storage, rate limiting, or any Redis integration. Covers cache-aside pattern, key naming, TTL strategy, and serialization config.

AI & Automation 260 stars 40 forks Updated 4 days ago MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
80
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Spring Data Redis ## Dependencies ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-cache</artifactId> </dependency> ``` ## Configuration ```java @Configuration @EnableCaching public class RedisConfig { @Bean public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) { RedisTemplate<String, Object> template = new RedisTemplate<>(); template.setConnectionFactory(factory); template.setKeySerializer(new StringRedisSerializer()); template.setValueSerializer(jsonSerializer()); // JSON, not Java serialize template.setHashKeySerializer(new StringRedisSerializer()); template.setHashValueSerializer(jsonSerializer()); return template; } @Bean public RedisCacheManager cacheManager(RedisConnectionFactory factory) { RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig() .entryTtl(Duration.ofMinutes(10)) .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer())) .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(jsonSerializer())) .disableCachingNullValues(); return RedisCacheManager.builder(factory) .cacheDefaults(config) ...

Details

Author
rrezartprebreza
Repository
rrezartprebreza/spring-boot-skills
Created
4 months ago
Last Updated
4 days ago
Language
Java
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

Data & Documents Listed

redis-dev

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 语言。

0 Updated today
BaixuanZhu
API & Backend Listed

java-cache

Use when the user asks to add caching, configure Redis or Caffeine cache, use @Cacheable/@CacheEvict/@CachePut, optimize repeated database or API calls, or review existing Spring Boot cache configuration.

0 Updated today
limited-grisaille833
API & Backend Listed

redis

Use Redis correctly as a cache, queue, rate limiter, and ephemeral store — pick the right data structure, caching pattern, eviction policy, and atomicity model. Use when adding caching, designing a key schema, choosing cache-aside vs write-through, setting TTLs/eviction, building a rate limiter or queue, debugging low hit-rate or evictions, or deciding Redis-vs-Postgres for a use case. Triggers — "cache", "Redis", "rate limit", "session store", "pub/sub", "cache invalidation", "TTL", "hit rate". Pairs with db-design (durable store — Redis is ephemeral), sql-authoring (the source of truth behind the cache), performance (cache as a latency lever).

6 Updated yesterday
kouroshez