Este contenido no está disponible en el idioma seleccionado.

2.2. Creating CacheManagers


2.2.1. Create a New RemoteCacheManager

Use the following configuration to configure a new RemoteCacheManager:
import org.infinispan.client.hotrod.configuration.Configuration;
import org.infinispan.client.hotrod.configuration.ConfigurationBuilder;

Configuration conf = new 
ConfigurationBuilder().addServer().host("localhost").port(11222).build();
RemoteCacheManager manager = new RemoteCacheManager(conf);
RemoteCache defaultCache = manager.getCache();
Copy to Clipboard Toggle word wrap
Configuration Explanation

An explanation of each line of the provided configuration is as follows:

  1. Use the ConfigurationBuilder() method to configure a new builder. The .addServer() property adds a remote server, specified via the .host(<hostname|ip>) and .port(<port>) properties.
    Configuration conf = new 
    ConfigurationBuilder().addServer().host(<hostname|ip>).port(<port>).build();
    
    Copy to Clipboard Toggle word wrap
  2. Create a new RemoteCacheManager using the supplied configuration.
    RemoteCacheManager manager = new RemoteCacheManager(conf);
    Copy to Clipboard Toggle word wrap
  3. Retrieve the default cache from the remote server.
    RemoteCache defaultCache = manager.getCache();
    
    Copy to Clipboard Toggle word wrap
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2026 Red Hat
Volver arriba