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? I'm using JPA 2.0 as persistence provider.
I am particularly worried 开发者_Go百科about having to run the cache client as a single-thread / singleton 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...
Can anyone recommend a good 2nd level object caching solution for Java EE 6 applications
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.
Just in case, refer to the chapter 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).
I am particularly worried about having to run the cache client as a single-thread / singleton 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.
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 enables caching by default, so you are probably already caching, and don't need to do anything.
See, http://en.wikibooks.org/wiki/Java_Persistence/Caching
http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Caching
精彩评论