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:
@@ -0,0 +1,35 @@
|
||||
# @RedisHash(timeToLive = 2) with Boot's defaults (keyspace events OFF)
|
||||
|
||||
|
||||
--- Server setting ---
|
||||
$ redis-cli -p 6390 --no-raw CONFIG GET notify-keyspace-events
|
||||
1) "notify-keyspace-events"
|
||||
2) ""
|
||||
|
||||
--- Save a session that lives for two seconds ---
|
||||
sessions.save(new Session("s1", "ankur"))
|
||||
$ redis-cli -p 6390 KEYS '*' | sort
|
||||
session
|
||||
session:s1
|
||||
session:s1:idx
|
||||
session:user:ankur
|
||||
$ redis-cli -p 6390 --no-raw TTL session:s1
|
||||
(integer) 2
|
||||
|
||||
--- Wait for Redis to expire it ---
|
||||
$ redis-cli -p 6390 --no-raw EXISTS session:s1
|
||||
(integer) 0
|
||||
|
||||
--- What is left behind ---
|
||||
$ redis-cli -p 6390 KEYS '*' | sort
|
||||
session
|
||||
session:s1:idx
|
||||
session:user:ankur
|
||||
$ redis-cli -p 6390 SMEMBERS session | sort
|
||||
s1
|
||||
$ redis-cli -p 6390 SMEMBERS session:user:ankur | sort
|
||||
s1
|
||||
|
||||
--- What the repository says ---
|
||||
sessions.findById("s1") = Optional.empty
|
||||
sessions.count() = 1
|
||||
Reference in New Issue
Block a user