Hibernate 6 二级缓存

huangapple go评论49阅读模式
英文:

Hibernate 6 Second Level Cache

问题

有人尝试将 hibernate-ehcache 与最新的 Spring Boot 3 和 hibernate 6 配合使用吗?根据库的最新更新(6.0.0-alpha7,最后更新于 2021 年),似乎不再继续开发了?有什么新的替代品可以取代它吗,我之前有所遗漏吗?

英文:

Did anyone try to get hibernate-ehcache to work with latest Spring Boot 3 and hibernate 6? Taken from the last updates to the library (6.0.0-alpha7 with last update in 2021) this seems not to be continued? Is there something new to replace it that I have missed so far?

答案1

得分: 4

推荐的方法是使用 JCache API 来进行缓存,而不是直接使用普通的 EhCache。EhCache 支持 JCache API,因此你仍然可以将 EhCache 用作缓存实现。

使用 hibernate-jcache 依赖项并进行相应的配置。

如何进行配置已在这里的 Hibernate 文档中进行了解释。

英文:

The recommended approach is to use the JCache API instead of plain EhCache to do the caching. EhCache supports the JCache API so you can still use EhCache as the cache implementation.

Use the hibernate-jcache dependency and configure it accordingly.

How to do the configuration is explained here in the Hibernate documentation.

答案2

得分: 0

我写了一篇关于如何在Spring Boot和Hibernate中使用Redisson作为二级缓存(2LC)的文章:https://blog.coffeebeans.at/archives/1919。由于项目中已经使用了Redis,所以我放弃了Ehcache,并且Redisson提供了一个兼容的实现,使用了Redis =)

如果您有任何问题,请告诉我。

感谢M. Deinum提供的提示,用JCache替代Hibernate-Ehcache。

英文:

I wrote a post about how to use redisson as 2LC with spring boot and hibernate: https://blog.coffeebeans.at/archives/1919. I got rid of ehcache as redis was already in the project and redisson provides a compatible implementation that uses redis =)

If you have any questions, please let me know.

Thanks to M. Deinum for your hint to jcache to replace hibernate-ehcache.

huangapple
  • 本文由 发表于 2023年3月7日 16:31:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/75659572.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定