検索

第5章 カウンターの操作

download PDF

カウンターは、オブジェクトの数を記録するアトミック増減分操作を提供します。

前提条件

  • Data Grid CLI を起動している。
  • 実行中の Data Grid クラスターに接続している。

5.1. カウンターの作成

Data Grid CLI を使用して強力なカウンターと弱いカウンターを作成します。

手順

  1. Data Grid への CLI 接続を作成します。
  2. 適切な引数を指定して create counter コマンドを実行します。

    1. my-weak-counter を作成します。

      [//containers/default]> create counter --concurrency-level=1 --initial-value=5 --storage=PERSISTENT --type=weak my-weak-counter
    2. my-strong-counter を作成します。

      [//containers/default]> create counter --initial-value=3 --storage=PERSISTENT --type=strong my-strong-counter
  3. 使用可能なカウンターをリスト表示します。

    [//containers/default]> ls counters
    my-strong-counter
    my-weak-counter
  4. カウンター設定を確認します。

    1. my-weak-counter について説明します。

      [//containers/default]> describe counters/my-weak-counter
      
      {
          "weak-counter":{
              "initial-value":5,
              "storage":"PERSISTENT",
              "concurrency-level":1
          }
      }
    2. my-strong-counter について説明します。

      [//containers/default]> describe counters/my-strong-counter
      
      {
          "strong-counter":{
              "initial-value":3,
              "storage":"PERSISTENT",
              "upper-bound":5
          }
      }
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

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

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

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

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

会社概要

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

© 2024 Red Hat, Inc.