tags:

views:

97

answers:

1

Can anyone recommend a good 2nd level object caching solution for JEE 6 applications, and give background to your recommendation? I'm using JPA 2.0 as persistence provider.

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've good experience using memcached from a PHP webapp, but PHP is of course single-threaded, so that was never an issue...

+1  A: 

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.

Pascal Thivent
Ok, I'm beginning to understand - the cache is provided by the container/JPA provider, not an external application (like memcached)? I use EclipseLink as JPA provider, so that's where I should look then, right (http://wiki.eclipse.org/Introduction_to_Cache_%28ELUG%29)?
Hank
@Hank: The cache *is* provided by a 3rd-party library (usually inside the VM), but it's *managed* by the JPA provider.
skaffman
@Hank For JPA 2.0, the right place to start with is http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/cache_usaged#Section_3.7.1_-_The_shared-cache-mode_element
Pascal Thivent