简体   繁体   English

什么是Java EE应用程序的良好二级缓存?

[英]What's a good 2nd level cache for Java EE applications?

Can anyone recommend a good 2nd level object caching solution for Java EE 6 applications, and give background to your recommendation? 任何人都可以为Java EE 6应用程序推荐一个好的二级对象缓存解决方案,并给出你的推荐背景吗? I'm using JPA 2.0 as persistence provider. 我正在使用JPA 2.0作为持久性提供程序。

I am particularly worried about having to run the cache client as a single-thread / singleton bean. 我特别担心必须将缓存客户端作为单线程/单例bean运行。 Is that the case? 是这样的吗? If so, is that an issue? 如果是这样,那是一个问题吗?

I've good experience using memcached from a PHP webapp, but PHP is of course single-threaded, so that was never an issue... 我在使用PHP webapp的memcached方面有很好的经验,但PHP当然是单线程的,所以这绝不是问题......

Can anyone recommend a good 2nd level object caching solution for Java EE 6 applications 任何人都可以为Java EE 6应用程序推荐一个好的第二级对象缓存解决方案

While the L2 cache contract is standardized in JPA 2.0, L2 Cache implementation is vendor specific and you may or may not plug in different L2 caches. 虽然L2缓存合约在JPA 2.0中是标准化的,但L2缓存实现是特定于供应商的,您可能会也可能不会插入不同的L2缓存。

Just in case, refer to the chapter 19.2. 以防万一,请参阅第19.2 The Second Level Cache for Hibernate (as you'll see, there is no single answer to the question and choosing one implementation or another depends on your needs and on the way you'll use the cache). Hibernate的二级缓存 (正如您所看到的,问题没有一个答案,选择一个或另一个实现取决于您的需求和您将使用缓存的方式)。

I am particularly worried about having to run the cache client as a single-thread / singleton bean. 我特别担心必须将缓存客户端作为单线程/单例bean运行。 Is that the case? 是这样的吗? If so, is that an issue? 如果是这样,那是一个问题吗?

I don't understand the question. 我不明白这个问题。 You don't have to worry about anything, the JPA provider interacts with the cache, not you. 您不必担心任何事情,JPA提供程序与缓存交互,而不是您。

EclipseLink includes an integrated L2 caching implementation, it does not require a 3rd party cache, although can be integrated with Oracle Coherence through Oracle TopLink Grid. EclipseLink包含一个集成的L2缓存实现,它不需要第三方缓存,但可以通过Oracle TopLink Grid与Oracle Coherence集成。

EclipseLink enables caching by default, so you are probably already caching, and don't need to do anything. EclipseLink默认启用缓存,因此您可能已经在缓存,并且不需要执行任何操作。

See, http://en.wikibooks.org/wiki/Java_Persistence/Caching 请参阅http://en.wikibooks.org/wiki/Java_Persistence/Caching

http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Caching http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Caching

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

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