Add redis: Boot 4.1 + Spring Data Redis 4.1, the JDK-serialisation default vs Jackson 3 serializers, @RedisHash TTL and keyspace events, @RedisListener, and Redis as the Spring cache

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B38FGKKam5SCGgwgduVAh3
This commit is contained in:
Claude
2026-09-21 15:46:55 +00:00
parent 8cdfcd4d8d
commit b0c39a8d4c
60 changed files with 2900 additions and 1 deletions
+34
View File
@@ -0,0 +1,34 @@
[Home](../README.md) | Prev: [Redis as the Spring cache](09-redis-as-cache.md)
# 10. Production checklist
Each line points at the chapter where the reason was demonstrated. Items marked *not run here* are
general advice this repository does not exercise.
**Serialization**
- [ ] Keys go through `StringRedisSerializer`, in every template, in every service that shares the Redis ([chapters 2 and 3](03-string-template-and-two-keyspaces.md)).
- [ ] Values are JSON with a serializer you chose, not the JDK default ([chapter 4](04-json-serializers.md)).
- [ ] If you use the generic Jackson serializer, it has a `PolymorphicTypeValidator` allow-list, not `enableUnsafeDefaultTyping()` ([chapter 4](04-json-serializers.md)).
- [ ] You are on `GenericJacksonJsonRedisSerializer` / `JacksonJsonRedisSerializer`, not the deprecated `Jackson2` classes ([chapter 4](04-json-serializers.md)).
- [ ] Changing a serializer on a Redis that already has data has a migration or a new key prefix (*not run here*).
**Expiry**
- [ ] Every cache and session key has a TTL, and refreshes re-supply it ([chapter 8](08-ttl.md)).
- [ ] `@RedisHash` entities with `timeToLive` either have keyspace events on or you accept the leftover index entries ([chapter 6](06-hash-ttl-and-keyspace-events.md)).
- [ ] Nothing correctness-critical depends on receiving an expiry event ([chapters 6 and 7](07-pub-sub.md)).
- [ ] With a custom `RedisCacheConfiguration`, the TTL is in the bean ([chapter 9](09-redis-as-cache.md)).
**Messaging**
- [ ] Pub/Sub is used only for messages you can afford to lose ([chapter 7](07-pub-sub.md)).
**Operations** (*not run here*)
- [ ] `KEYS *` is fine in these transcripts because the keyspace has a handful of keys. On a real server it is O(N) and blocks it; use `SCAN`.
- [ ] Redis requires authentication and is not reachable from the internet. Anyone who can write to it can choose the class your generic serializer instantiates ([chapter 4](04-json-serializers.md)).
- [ ] Connection and command timeouts are set deliberately, not left at defaults.
- [ ] Do not point these tests at a production Redis: [LocalRedis](../src/test/java/com/ankurm/redis/LocalRedis.java) exists to stop that, because the tests call `FLUSHALL`.
[Home](../README.md) | Prev: [Redis as the Spring cache](09-redis-as-cache.md)