To use JCache, you may need to add it to your application—or to your server, depending on how you want to deploy it—since 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 ...