I use JCache and Infinispan as its implementation. JCache does not provide any API related to clustering, so I defined simple replicated cache configuration in XML configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns="urn:infinispan:config:8.2">
<cache-container default-cache="default">
<transport cluster="test-cluster"/>
<replicated-cache-configuration name="userCacheConfig" mode="SYNC" statistics="true"/>
</cache-container>
</infinispan>
Now to create user cache I need to combine this declarative configuration with programmatic configuration because the values of some cache properties (expiration timeout for example) should be retrieved from DB. Is there a way to do it using classes and interfaces from JCache only?