Setting up JCache

To use JCache, you may need to add it to your application—or to your server, depending on how you want to deploy itsince not all servers add it in their distribution(s). To do it with maven, you can add this dependency:

<dependency>    <groupId>javax.cache</groupId>    <artifactId>cache-api</artifactId>    <version>1.0.0</version></dependency>

Then the only thing you will need to do is select an implementation and add it as well. The most common ones are the following:

  • Apache Ignite
  • JBoss Infinispan
  • Apache JCS
  • Ehcache
  • Oracle Coherence
  • Hazelcast

As often, the choice of the provider is a multicriteria choice and you will probably want to take the following into account:

  • The performances
  • The dependency stack the provider enforces ...

Get Java EE 8 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.