JCache Integration Bridge for Java EE 8
Integrate JSR-107 (JCache) with Java EE 8 considering already established conventions in specs like JPA or JAX-RS
Structure was inspired by JPA, cache.xml
<caches>
<caching-provider>org.jsr107.ri.spi.RICachingProvider</caching-provider>
<cache name="it" key="java.lang.String" value="java.lang.String">
<configuration>
<property name="store.by.value" value="true"/>
<property name="management.enabled" value="false"/>
<property name="statistics.enabled" value="true"/>
<property name="vendor.specific" value="unicorn"/>
</configuration>
</cache>
<cache name="hack3rz" key="java.lang.String" value="java.lang.String">
<configuration>
<property name="store.by.value" value="false"/>
<property name="management.enabled" value="true"/>
<property name="statistics.enabled" value="false"/>
<property name="java" value="duke"/>
</configuration>
</cache>
</caches>
@Inject
@CacheContext("it")
Cache first;
@Inject
@CacheContext("hack3rz")
Cache second;
@Inject
@CacheContext("hack3rz")
Cache alreadyInjected;
@Test
public void cachesWithDifferentNamesAreNotSame() {
assertNotSame(first, second);
}
@Test
public void cachesWithSameNameAreSame() {
assertSame(second, alreadyInjected);
}