第3章 Hot Rod C++ クライアントの設定


Hot Rod C++ クライアントは、RemoteCache API 経由でリモート Data Grid クラスターと対話します。

3.1. 設定およびリモートキャッシュマネージャー API

ConfigurationBuilder API を使用して、Hot Rod C++ クライアント接続と RemoteCacheManager API を設定してリモートキャッシュを取得および設定します。

設定ビルダー

#include "infinispan/hotrod/ConfigurationBuilder.h"
#include "infinispan/hotrod/RemoteCacheManager.h"
#include <infinispan/hotrod/RemoteCache.h>
#include <iostream>
int main () {
  ConfigurationBuilder builder;
    // Configure a cache manager to connect with Hot Rod version 2.8
    builder.protocolVersion(Configuration::PROTOCOL_VERSION_28);
    // Connect to a server at localhost with the default port.
    builder.addServer().host("127.0.0.1").port(11222);
    // Create and start a RemoteCacheManager to interact with caches.
    RemoteCacheManager cacheManager(builder.build(), false);
    cacheManager.start();
    ...
}

クロスサイトレプリケーション

ConfigurationBuilder builder;
  builder.addServer().host("127.0.0.1").port(11222);
  // Configure a remote cluster and node when using cross-site replication.
  builder.addCluster("NYC").addClusterNode("192.0.2.0", 11322);

ニアキャッシュ

ConfigurationBuilder builder;
  builder.addServer().host("127.0.0.1").port(11222);
  // Enable near-caching for the client.
  builder.nearCache().mode(NearCacheMode::INVALIDATED).maxEntries(4);

Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.