Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

caching

jpa

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 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...

like image 845
Hank Avatar asked Feb 26 '26 16:02

Hank


2 Answers

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.

like image 154
Pascal Thivent Avatar answered Mar 01 '26 22:03

Pascal Thivent


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

like image 33
James Avatar answered Mar 01 '26 21:03

James



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!