简体   繁体   English

如何在spring数据jpa中使用redis提供二级缓存?

[英]How to provide second level cache with redis in spring data jpa?

How to provide second level cache with redis in spring data jpa? 如何在spring数据jpa中使用redis提供二级缓存?

not only hibernate,I hope all jpa provider can use this cache. 不仅hibernate,我希望所有jpa提供者都可以使用这个缓存。

somebody can help? 有人可以帮忙吗?

This depends on a JPA implementation library used by an application with spring-data-jpa. 这取决于具有spring-data-jpa的应用程序使用的JPA实现库。 I'll be speaking about 2 popular JPA implementations: Hibernate and Eclipselink. 我将谈论两个流行的JPA实现:Hibernate和Eclipselink。

Eclipselink is only able to use its own 2nd level cache provider and hence is not able to leverage Redis as a 2nd level cache. Eclipselink只能使用自己的二级缓存提供程序,因此无法将Redis用作二级缓存。

Hibernate provides an ability to use 3rd party cache libraries as a 2nd level cache provider. Hibernate提供了将第三方缓存库用作二级缓存提供程序的功能。 Latest Hibernate 5.1 comes with built-in support for two caching libraries: Ehcache and Infinispan: Hibernate documentation . 最新的Hibernate 5.1内置支持两个缓存库:Ehcache和Infinispan: Hibernate文档 There are proprietary and open source libraries supporting other caching providers including Redis: GitHub: debop/hibernate-redis . 有专有和开源库支持其他缓存提供程序,包括Redis: GitHub:debop / hibernate-redis

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM