16.3. リモートキャッシュの作成
JCache API 仕様で定義されているデフォルトの設定オプションを使用したリモートキャッシュ(クライアントサーバーモード)の作成は、以下のように簡単です。
import javax.cache.*;
import javax.cache.configuration.*;
// Retrieve the system wide cache manager via org.infinispan.jcache.remote.JCachingProvider
CacheManager cacheManager = Caching.getCachingProvider("org.infinispan.jcache.remote.JCachingProvider").getCacheManager();
// Define a named cache with default JCache configuration
Cache<String, String> cache = cacheManager.createCache("remoteNamedCache",
new MutableConfiguration<String, String>());
注記
org.infinispan.jcache.remote.JCachingProvider を使用するには、infinispan-jcache-remote-<version>.jar とその推移的な依存関係がすべてクラスパスに配置する必要があります。