/** @throws IllegalArgumentException if the specified cache name is invalid. */ private static void ensureCacheConfiguration(ClientCacheConfiguration cfg) { if (cfg == null) throw new IllegalArgumentException("Cache configuration must be specified"); ensureCacheName(cfg.getName()); }
/** {@inheritDoc} */ @Override public <K, V> ClientCache<K, V> createCache(ClientCacheConfiguration cfg) throws ClientException { ensureCacheConfiguration(cfg); ch.request(ClientOperation.CACHE_CREATE_WITH_CONFIGURATION, req -> serDes.cacheConfiguration(cfg, req, toClientVersion(ch.serverVersion()))); return new TcpClientCache<>(cfg.getName(), ch, marsh); }
/** {@inheritDoc} */ @Override public <K, V> ClientCache<K, V> getOrCreateCache( ClientCacheConfiguration cfg) throws ClientException { ensureCacheConfiguration(cfg); ch.request(ClientOperation.CACHE_GET_OR_CREATE_WITH_CONFIGURATION, req -> serDes.cacheConfiguration(cfg, req, toClientVersion(ch.serverVersion()))); return new TcpClientCache<>(cfg.getName(), ch, marsh); }
}; itemWriter.accept(CfgItem.NAME, w -> w.writeString(cfg.getName())); itemWriter.accept(CfgItem.CACHE_MODE, w -> w.writeInt(cfg.getCacheMode().ordinal())); itemWriter.accept(CfgItem.ATOMICITY_MODE, w -> w.writeInt(cfg.getAtomicityMode().ordinal()));
/** @throws IllegalArgumentException if the specified cache name is invalid. */ private static void ensureCacheConfiguration(ClientCacheConfiguration cfg) { if (cfg == null) throw new IllegalArgumentException("Cache configuration must be specified"); ensureCacheName(cfg.getName()); }
/** {@inheritDoc} */ @Override public <K, V> ClientCache<K, V> getOrCreateCache( ClientCacheConfiguration cfg) throws ClientException { ensureCacheConfiguration(cfg); ch.request(ClientOperation.CACHE_GET_OR_CREATE_WITH_CONFIGURATION, req -> serDes.cacheConfiguration(cfg, req, toClientVersion(ch.serverVersion()))); return new TcpClientCache<>(cfg.getName(), ch, marsh); }
/** {@inheritDoc} */ @Override public <K, V> ClientCache<K, V> createCache(ClientCacheConfiguration cfg) throws ClientException { ensureCacheConfiguration(cfg); ch.request(ClientOperation.CACHE_CREATE_WITH_CONFIGURATION, req -> serDes.cacheConfiguration(cfg, req, toClientVersion(ch.serverVersion()))); return new TcpClientCache<>(cfg.getName(), ch, marsh); }
}; itemWriter.accept(CfgItem.NAME, w -> w.writeString(cfg.getName())); itemWriter.accept(CfgItem.CACHE_MODE, w -> w.writeInt(cfg.getCacheMode().ordinal())); itemWriter.accept(CfgItem.ATOMICITY_MODE, w -> w.writeInt(cfg.getAtomicityMode().ordinal()));