Spring Session – 支持 Redis 以外的其他后端实现

Spring Session – Support for other Backend Implementations other then Redis

我想在我目前的项目中使用"Spring Session",但目前似乎只有Redis是支持的后端数据库。官方文档还没有谈到任何其他支持。

是否有其他数据库的替代实现?例如,Memcached 或 Couchbase 支持如何,它们也是快速的 Key-/Value 存储?

据我所知,仅支持 redis 和 hazelcast,但也许您可以找到一些第三方。或者您可能想自己实现它(并使其开源)。它似乎并没有那么复杂 - 参见

https://github.com/spring-projects/spring-session/blob/1.0.1.RELEASE/samples/hazelcast/src/main/java/sample/Initializer.java

看来您只需要实施 SessionRepository 并使用适当的 HTTP 过滤器。