Redis エクステンションリファレンスガイド
stableRedis は、データベース、キャッシュ、ストリーミングエンジン、メッセージブローカーとして使用されるインメモリデータストアです。 Quarkus Redis エクステンションを使用すると、 Quarkus アプリケーションを Redis と統合できます。
このエクステンションを使用するには、ユーザーが Redis に精通している必要があり、特にコマンドのメカニズムとそれらがどのように構成されているかを理解している必要があります。 通常、以下を推奨します。
-
Redis を紹介する 対話型チュートリアル。
-
Redis コマンドを説明し、リファレンスドキュメントへのリンクが含まれている コマンドリファレンス。
このエクステンションは、命令型およびリアクティブ API、ならびにローレベルおよびハイレベル (型安全) なクライアントを提供します。
1. Redis クライアントの使用
このエクステンションを使用する場合は、まず io.quarkus:quarkus-redis エクステンションを追加する必要があります。 pom.xml ファイルに以下を追加します。
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-redis-client</artifactId>
</dependency>
implementation("io.quarkus:quarkus-redis-client")
この依存関係により、以下のような Redis クライアントまたは データソース (ハイレベルで型安全な API) をインジェクトできます。
import io.quarkus.redis.datasource.RedisDataSource;
// ...
@Inject RedisAPI lowLevelClient;
@Inject RedisDataSource highLevelApi;
quarkus-redis エクステンションが提供するさまざまな API の詳細は、 1 つのエクステンション、複数の API セクションで確認できます。
| Redis をキャッシュバックエンドとして使用するには、 Redis キャッシュバックエンドリファレンス を参照してください。 |
2. 1 つのエクステンション、複数の API
このエクステンションは、 Redis とやり取りするための複数の方法を提供します。
-
ローレベル な Vert.x クライアント。これは完全にリアクティブでノンブロッキング、かつ非同期なクライアントです。 詳細は Vert.x Redis クライアントドキュメント を参照してください。
io.vertx.redis.client.Redisとio.vertx.redis.client.RedisAPIの 2 つの API が公開されています。 接続を自分で管理する必要がある場合を除き、通常は後者を使用します。 -
Vert.x API の ローレベル な Mutiny バリアント。前述のものとは異なり、 Mutiny API を公開し、リアクティブメソッドと命令型メソッド (
andAwait()という接尾辞が付いたもの) の両方を提供します。io.vertx.mutiny.redis.client.Redisとio.vertx.mutiny.redis.client.RedisAPIの 2 つの API が公開されています。 接続を自分で管理する必要がある場合を除き、通常は後者を使用します。 -
ハイレベル なリアクティブデータソース。 Redis とやり取りするための型安全でハイレベルな API です。 この API は完全にリアクティブで非同期です。 Mutiny API を公開しています。
io.quarkus.redis.datasource.ReactiveRedisDataSourceインターフェイスを公開します。 -
ハイレベル な命令型データソース。 Redis とやり取りするための型安全でハイレベルな API です。 リアクティブデータソースの命令型バリアントです。
io.quarkus.redis.datasource.RedisDataSourceインターフェイスを公開します。
適切な API を選択するための推奨事項を以下に示します。
-
Redis と統合する命令型 (クラシック) な Quarkus アプリケーションを構築している場合。
io.quarkus.redis.datasource.RedisDataSourceを使用してください。 -
Redis と統合するリアクティブな Quarkus アプリケーションを構築している場合。
io.quarkus.redis.datasource.ReactiveRedisDataSourceを使用してください。 -
きめ細かな制御が必要な場合や、汎用的な方法でコマンドを実行する場合。
io.vertx.mutiny.redis.client.RedisAPIを使用してください。 -
既存の Vert.x コードがある場合。
io.vertx.redis.client.RedisAPIを使用してください。 -
カスタムコマンドを発行する必要がある場合。データソース (リアクティブまたは命令型) または
io.vertx.mutiny.redis.client.Redisのいずれかを使用できます。
3. デフォルトおよび名前付きクライアントのインジェクト
このエクステンションでは、 デフォルト の Redis クライアント/データソース、または 名前付き のものを設定できます。 後者は、複数の Redis インスタンスに接続する必要がある場合に不可欠です。
デフォルトの接続は quarkus.redis.* プロパティーを使用して設定されます。 例えば、デフォルトの Redis クライアントを設定するには、以下を使用します。
quarkus.redis.hosts=redis://localhost/
デフォルトの接続を使用する場合、 プレーン な @Inject を使用してさまざまな API をインジェクトできます。
@ApplicationScoped
public class RedisExample {
@Inject ReactiveRedisDataSource reactiveDataSource;
@Inject RedisDataSource redisDataSource;
@Inject RedisAPI redisAPI;
// ...
}
| 通常は単一のものをインジェクトします。前のスニペットは単なる例です。 |
名前付き クライアントは quarkus.redis.<name>.* プロパティーを使用して設定されます。
quarkus.redis.my-redis-1.hosts=redis://localhost/
quarkus.redis.my-redis-2.hosts=redis://my-other-redis:6379
API にアクセスするには、 @RedisClientName 修飾子を使用する必要があります。
@ApplicationScoped
public class RedisExample {
@Inject @RedisClientName("my-redis-1") ReactiveRedisDataSource reactiveDataSource;
@Inject @RedisClientName("my-redis-2") RedisDataSource redisDataSource;
// ...
}
@RedisClientName を使用する場合、 @Inject アノテーションを省略できます。
|
3.1. Redis クライアントの有効化または無効化
Redis クライアントがビルド時に設定され、その URL が実行時に設定されている場合、デフォルトで有効になります。 Quarkus は、アプリケーションの起動時に対応する Redis クライアントを起動します。
実行時に Redis クライアントを無効にするには、以下のいずれかを行います。
-
quarkus.redis[.optional name].hostsまたはquarkus.redis[.optional name].hosts-provider-nameを設定しない。 -
quarkus.redis[.optional name].activeをfalseに設定する。
Redis クライアントがアクティブでない場合。
-
Redis クライアントは、アプリケーションの起動中に Redis への接続を試行しません。
-
Redis クライアントは ヘルスチェック に寄与しません。
-
@Inject ReactiveRedisDataSource redisや@Inject RedisDataSource redisなど、 Redis クライアントに関連する静的な CDI インジェクションポイントは、アプリケーションの起動を失敗させます。 -
CDI.getBeanContainer()、Arc.instance()、またはインジェクトされたInstance<ReactiveRedisDataSource>を介した Redis クライアントの動的な取得は、例外のスローを引き起こします。 -
Redis クライアントを消費する他の Quarkus エクステンションにより、アプリケーションの起動が失敗する可能性があります。
この機能は、アプリケーションが実行時に事前定義されたセットから Redis クライアントを動的に選択する必要がある場合に特に役立ちます。
quarkus.redis.one.active=false
quarkus.redis.one.hosts=redis://localhost:64251
quarkus.redis.two.active=false
quarkus.redis.two.hosts=redis://localhost:64251
import io.quarkus.arc.InjectableInstance;
@ApplicationScoped
public class MyConsumer {
@Inject
@RedisClientName("one")
InjectableInstance<ReactiveRedisDataSource> one;
@Inject
@RedisClientName("two")
InjectableInstance<ReactiveRedisDataSource> two;
public void doSomething() {
ReactiveRedisDataSource redis = one.getActive();
// ...
}
}
実行時に quarkus.redis.one.active=true を設定すると、 Redis クライアント one のみが利用可能になります。 実行時に quarkus.redis.two.active=true を設定すると、 Redis クライアント two のみが利用可能になります。
|
Redis クライアント (デフォルトまたは名前付き) は、実行時のインジェクション対象となるために、常にビルド時に検出可能である必要があります。 これは、 |
4. Redis サーバーへの接続
Redis エクステンションは、 4 つの異なるモードで動作できます。
-
シンプルクライアント (おそらくほとんどのユーザーが必要とするもの)。
-
Sentinel (高可用性 (HA) モードで Redis を使用する場合)。
-
Cluster (クラスターモードで Redis を使用する場合)。
-
Replication (シングルシャード、 1 ノード書き込み、複数読み取り)。
接続 URL は、以下のように quarkus.redis.hosts (または quarkus.redis.<name>.hosts) で設定されます。
quarkus.redis.hosts=redis://[:password@]host[:port][/db-number]
4.1. Unix ドメインソケットの使用
Unix ドメインソケットを使用する場合、以下が必要です。
quarkus.redis.hosts=unix://[:password@]/domain/docker.sock[?select=db-number]
4.2. Sentinel モードの使用
Sentinel を使用する場合、複数の ホスト URL を渡し、クライアントタイプを sentinel に設定する必要があります。
quarkus.redis.hosts=redis://localhost:5000,redis://localhost:5001,redis://localhost:5002
quarkus.redis.client-type=sentinel
# Optional
quarkus.redis.master-name=my-sentinel # Default is mymaster
quarkus.redis.role=master # master is the default
ここでのホスト URL は Sentinel サーバーである必要があります。 クライアントは、 master-name を 「マスターセット」 の識別子として使用し、 Sentinel の 1 つから実際の Redis サーバー ( role に応じてマスターまたはレプリカ) の URL を取得します。
実際には quarkus.redis.role=sentinel を設定したいケースはほとんどないことに注意してください。 この設定は、 Redis クライアントが Sentinel によって保護されている実際の Redis サーバーではなく、 Sentinel サーバーの 1 つで直接コマンドを実行することを意味します。
4.2.1. 自動フェイルオーバー
Sentinel モードでは、 マスター 接続の自動フェイルオーバーを設定できます。
quarkus.redis.auto-failover=true
有効にすると、 Sentinel クライアントは追加で 1 つの Sentinel ノードへの接続を作成し、フェイルオーバーイベントを監視します。 新しいマスターが選出されると、古いマスターへのすべての接続が自動的に閉じられ、新しいマスターへの新しい接続が作成されます。 自動フェイルオーバーは、通常のコマンドを実行する接続には有効ですが、 Redis の pub/sub チャネルのサブスクライブに使用される接続には適していません。
古いマスターが故障してから新しいマスターが選出されるまでの短い期間は、既存の接続ですべての操作が一時的に失敗することに注意してください。 新しいマスターが選出された後、接続は自動的にフェイルオーバーし、再び動作を開始します。
4.3. Cluster モードの使用
クラスターモードで Redis を使用する場合、複数の ホスト URL を渡し、クライアントタイプを cluster に設定し、 replicas モードを設定する必要があります。
quarkus.redis.hosts=redis://localhost:7000,redis://localhost:7001,redis://localhost:7002
quarkus.redis.client-type=cluster
# Optional
quarkus.redis.replicas=share # defaults to "never"
ここでのホスト URL は、クラスターメンバーの一部である必要があります。 クライアントは既知のサーバーの 1 つから完全なクラスター構成 (トポロジー) を取得するため、すべてのクラスターメンバーを設定する必要はありません。 ただし、 1 つだけでなく、少なくとも 2 つまたは 3 つのノードを設定することをお勧めします。
デフォルトでは、すべてのコマンドはマスターノードに送信されます (コマンドにキーがある場合は、そのキーを所有するシャードのマスターノードに、そうでない場合はランダムなマスターノードに送信されます)。 読み取り専用コマンド (クエリ) をレプリカノードに送信するように Redis クライアントを設定することも可能です。 quarkus.redis.replicas 設定プロパティーを以下のように設定します。
-
never: レプリカノードを絶対に使用せず、常にクエリをマスターノードに送信します (これがデフォルトです)。 -
always: 常にレプリカノードを使用し (シャード内に複数のレプリカがある場合はランダムに選択されます)、クエリをマスターノードには送信しません。 -
share: クエリの実行にマスターノードとレプリカノードの両方を使用します (各クエリの特定のノードはランダムに選択されます)。
Redis のレプリケーションは非同期であるため、レプリカノードがマスターノードから遅れる可能性があることに注意してください。
4.4. Replication モードの使用
Replication モードを使用する場合、単一のホスト URL を渡し、タイプを replication に設定する必要があります。
quarkus.redis.hosts=redis://localhost:7000
quarkus.redis.client-type=replication
# Optional
quarkus.redis.replicas=share # defaults to "never"
デフォルトでは、すべてのコマンドはマスターノードに送信されます。 読み取り専用コマンド (クエリ) をレプリカノードに送信するように Redis クライアントを設定することも可能です。 quarkus.redis.replicas 設定プロパティーを以下のように設定します。
-
never: レプリカノードを絶対に使用せず、常にクエリをマスターノードに送信します (これがデフォルトです)。 -
always: 常にレプリカノードを使用し (複数のレプリカがある場合はランダムに選択されます)、クエリをマスターノードには送信しません。 -
share: クエリの実行にマスターノードとレプリカノードの両方を使用します (各クエリの特定のノードはランダムに選択されます)。
Redis のレプリケーションは非同期であるため、レプリカノードがマスターノードから遅れる可能性があることに注意してください。
4.4.1. 静的トポロジー
Replication モードでは、トポロジーの自動検出をスキップするように Redis クライアントを再設定できます。
quarkus.redis.topology=static
静的トポロジーを使用すると、設定の最初のノードが マスター ノードであると見なされ、残りのノードは レプリカ であると見なされます。 ノードの検証は行われません。静的設定が正しいことを確認するのはアプリケーション開発者の責任です。
通常はトポロジーの自動検出が推奨される選択肢であることに注意してください。 静的設定は、必要な場合にのみ使用してください。 そのようなケースの 1 つが Amazon Elasticache for Redis (クラスターモード無効) で、以下のようになります。
-
マスターノードを プライマリエンドポイント に設定し、
-
1 つのレプリカノードを リーダーエンドポイント に設定する必要があります。
| Elasticache for Redis (クラスターモード無効) のリーダーエンドポイントは、レプリカの 1 つを指す CNAME レコードに解決されるドメイン名であることに注意してください。 リーダーエンドポイントが解決される CNAME レコードは、時間の経過とともに変化します。 この形式の DNS ベースのロードバランシングは、 DNS 解像キャッシュや接続プーリングとうまく連携しません。 その結果、一部のレプリカが十分に活用されない可能性があります。 |
4.5. Redis Cloud への接続
Redis Cloud に接続するには、以下のプロパティーが必要です。
quarkus.redis.hosts=<the redis cloud url such as redis://redis-12436.c14.us-east-1-3.ec2.cloud.redislabs.com:12436>
quarkus.redis.password=<the password>
4.6. TLS の使用
TLS を使用するには、以下を行う必要があります。
-
quarkus.redis.tls.enabled=trueプロパティーを設定するか、 TLS レジストリー を使用します (推奨)。 -
URL が
rediss://(sが 2 つ) で始まっていることを確認してください。
TLS レジストリーを使用する場合、他の TLS 設定との競合を避けるために、名前付き設定を使用する必要があります。
quarkus.tls.redis.trust-store.p12.path=client.p12
quarkus.tls.redis.trust-store.p12.password=secret
quarkus.redis.tls-configuration-name=redis # Reference the named configuration
デフォルトのホスト名検証ツールは NONE に設定されており、ホスト名を検証しません。 この動作を変更するには、 quarkus.redis.tls.hostname-verification-algorithm プロパティーを例えば HTTPS に設定します。
|
4.7. 認証の設定
Redis のパスワードは redis:// URL 内、または quarkus.redis.password プロパティーで設定できます。 後者を推奨します。可能であれば、シークレットや環境変数を使用してパスワードを設定してください。
関連する環境変数は QUARKUS_REDIS_PASSWORD、または名前付きクライアントの場合は QUARKUS_REDIS_<NAME>_PASSWORD です。
4.8. 接続プーリング
Redis への接続は常にプールされます。 デフォルトでは、プール内の最大接続数は 6 です。 これは quarkus.redis.max-pool-size を使用して設定できます。
接続プールが枯渇すると、接続を取得しようとする試行はキューに入れられます。 デフォルトでは、 Redis 接続を取得するためにキューで待機する最大試行数は 24 です。 これは quarkus.redis.max-pool-waiting を使用して設定できます。
特定のコマンドを実行すると、サーバー側の状態と接続の動作が変更されます。 そのような接続は再利用できず、クローズされてもプールに戻されません。代わりに、実際にクローズされます。 この動作を引き起こすコマンドは以下の通りです。
-
サブスクリプションコマンド (
SUBSCRIBE、UNSUBSCRIBEなど) -
SELECT -
AUTH
5. Redis データソースの使用
Quarkus は、 Redis の上にハイレベルな API を公開しています。 この API は型安全であり、 Redis コマンドの構成 から継承された グループ という概念を中心に構造化されています。 この API を使用すると、 Redis コマンドをより便利かつ安全に実行できます。
5.1. データソースのインジェクト
設定された各 Redis クライアントに対して、 2 つの Redis データソースが公開されます。
-
io.quarkus.redis.datasource.RedisDataSource- 命令型 (ブロッキング) の Redis データソース。 各操作は、レスポンスが受信されるかタイムアウトに達するまでブロックされます。 -
io.quarkus.redis.datasource.ReactiveRedisDataSource-Uni<X>またはMulti<X>を返すリアクティブな Redis データソース。
デフォルト の Redis クライアントを設定した場合は、以下を使用してデータソースをインジェクトできます。
@Inject RedisDataSource defaultRedisDataSource;
@Inject ReactiveRedisDataSource defaultReactiveRedisDataSource;
名前付き の Redis クライアントを設定した場合は、 io.quarkus.redis.RedisClientName 修飾子を使用して適切なクライアントを選択する必要があります。
@RedisClientName("my-redis") RedisDataSource myRedisDataSource;
@RedisClientName("my-redis") ReactiveRedisDataSource myReactiveRedisDataSource;
ブロッキング バリアントを使用する場合、デフォルトのタイムアウトを以下で設定できます。
quarkus.redis.timeout=5s
quarkus.redis.my-redis.timeout=5s
デフォルトのタイムアウトは 10 秒に設定されています。
|
委譲について
ブロッキングデータソース ( |
5.1.1. データソースグループ
前述のように、 API はグループに分かれています。
-
bitmap -
.bitmap() -
key (汎用) -
.key() -
geo -
.geo(memberType) -
hash -
.hash(valueType) -
hyperloglog -
.hyperloglog(memberType) -
list -
.list(memberType) -
pubsub -
pubsub() -
set -
.set(memberType) -
sorted-set -
.sortedSet(memberType) -
string -
.value(valueType) -
stream -
.stream(valueType) -
transactions -
withTransaction -
json -
.json()(サーバー側に RedisJSON モジュールが必要) -
bloom -
.bloom()(サーバー側に RedisBloom モジュールが必要) -
cuckoo -
.cuckoo()(サーバー側に RedisBloom モジュールが必要。このモジュールは cuckoo フィルターコマンドも提供します) -
count-min -
.countmin()(サーバー側に RedisBloom モジュールが必要。このモジュールは count-min フィルターコマンドも提供します) -
top-k -
.topk()(サーバー側に RedisBloom モジュールが必要。このモジュールは top-k フィルターコマンドも提供します) -
graph -
.graph()(サーバー側に RedisGraph モジュールが必要)。 これらのコマンドは実験的なものとしてマークされています。 また、このモジュールは Redis によって 製品寿命 (EOL) であると宣言されています。 -
search -
.search()(サーバー側に RedisSearch モジュールが必要)。 -
auto-suggest -
.autosuggest()(サーバー側に RedisSearch モジュールが必要)。 -
time-series -
.timeseries()(サーバー側に Redis Time Series モジュールが必要)。
これらのコマンドは、安定させる前にフィードバックが必要なため、実験的なものとしてマークされています。
これらの各メソッドは、グループに関連するコマンドを実行できるオブジェクトを返します。 次のスニペットは、 hash グループの使用方法を示しています。
@ApplicationScoped
public class MyRedisService {
private static final String MY_KEY = "my-key";
private final HashCommands<String, String, Person> commands;
public MyRedisService(RedisDataSource ds) { (1)
commands = ds.hash(Person.class); (2)
}
public void set(String field, Person value) {
commands.hset(MY_KEY, field, value); (3)
}
public Person get(String field) {
return commands.hget(MY_KEY, field); (4)
}
}
| 1 | コンストラクターで RedisDataSource をインジェクトします。 |
| 2 | HashCommands オブジェクトを作成します。 このオブジェクトには、キーの型、フィールドの型、およびメンバーの型の 3 つの型パラメーターがあります。 |
| 3 | 作成された commands を使用して、フィールド field を値 value に関連付けます。 |
| 4 | 作成された commands を使用して、フィールド field の値を取得します。 |
5.2. データのシリアライズとデシリアライズ
データソース API は、シリアライズとデシリアライズを自動的に処理します。 デフォルトでは、非標準の型は JSON にシリアライズされ、 JSON からデシリアライズされます。 この場合、 quarkus-jackson が使用されます。
5.4. カスタムコーデック
io.quarkus.redis.datasource.codecs.Codec インターフェイスを実装する CDI Bean を提供することで、カスタムコーデックを登録できます。
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import jakarta.enterprise.context.ApplicationScoped;
import io.quarkus.redis.datasource.codecs.Codec;
@ApplicationScoped
public class PersonCodec implements Codec {
@Override
public boolean canHandle(Type clazz) {
return clazz.equals(Person.class);
}
@Override
public byte[] encode(Object item) {
var p = (Person) item;
return (p.firstName + ";" + p.lastName.toUpperCase()).getBytes(StandardCharsets.UTF_8);
}
@Override
public Object decode(byte[] item) {
var value = new String(item, StandardCharsets.UTF_8);
var segments = value.split(";");
return new Person(segments[0], segments[1]);
}
}
canHandle メソッドが呼び出され、コーデックが特定の型を処理できるかどうかがチェックされます。 encode メソッドで受け取ったパラメーターはその型と一致します。 decode メソッドによって返されるオブジェクトもその型と一致する必要があります。
5.5. 型参照の使用
各グループは、 Class または TypeReference オブジェクトを使用して設定できます。 TypeReference は Java ジェネリクスを扱う際に便利です。
@ApplicationScoped
public class MyRedisService {
private static final String MY_KEY = "my-key";
private final HashCommands<String, String, List<Person>> commands;
public MyRedisService(RedisDataSource ds) {
commands = ds.hash(new TypeReference<List<Person>>(){});
}
public void set(String field, List<Person> value) {
commands.hset(MY_KEY, field, value);
}
public List<Person> get(String field) {
return commands.hget(MY_KEY, field);
}
}
| トランザクションを使用する場合、型参照は使用できません。これは既知の制限事項です。 |
5.6. value グループによるキャッシュデータとバイナリデータの操作
value グループは、 Redis Strings を操作するために使用されます。 したがって、このグループは Java の String に限定されず、整数 (カウンターなど) やバイナリコンテンツ (画像など) にも使用できます。
5.6.1. キャッシュされた値の操作
setex コマンドを使用して Redis をキャッシュとして使用できます。これは指定された値を指定されたキーに指定された期間保存します。 次のスニペットは、このようなコマンドを使用して BusinessObject を 1 秒間保存する方法を示しています。
@ApplicationScoped
public static class MyRedisCache {
private final ValueCommands<String, BusinessObject> commands;
public MyRedisCache(RedisDataSource ds) {
commands = ds.value(BusinessObject.class);
}
public BusinessObject get(String key) {
return commands.get(key);
}
public void set(String key, BusinessObject bo) {
commands.setex(key, 1, bo); // Expires after 1 second
}
}
setnx メソッドを使用すると、指定されたキーに値が保存されていない場合にのみ値を設定できます。
key グループを使用すると、各キーの有効期限と TTL をより細かく制御できます。
|
|
|
5.6.2. バイナリデータの保存
Redis の Strings は、画像などのバイナリデータを保存するために使用できます。 この場合、値の型として byte[] を使用します。
@ApplicationScoped
public static class MyBinaryRepository {
private final ValueCommands<String, byte[]> commands;
public MyBinaryRepository(RedisDataSource ds) {
commands = ds.value(byte[].class);
}
public byte[] get(String key) {
byte[] bytes = commands.get(key);
if (bytes == null) {
throw new NoSuchElementException("`" + key + "` not found");
}
return bytes;
}
public void add(String key, byte[] bytes) {
commands.set(key, bytes);
}
public void addIfAbsent(String key, byte[] bytes) {
commands.setnx(key, bytes);
}
}
5.6.3. カウンターの保存
以下に示すように、 Redis にカウンターを保存できます。
@ApplicationScoped
public static class MyRedisCounter {
private final ValueCommands<String, Long> commands;
public MyRedisCounter(RedisDataSource ds) {
commands = ds.value(Long.class); (1)
}
public long get(String key) {
Long l = commands.get(key); (2)
if (l == null) {
return 0L;
}
return l;
}
public void incr(String key) {
commands.incr(key); (3)
}
}
| 1 | コマンドを取得します。 今回は Long 値を操作します。 |
| 2 | 指定された key に関連付けられたカウンターを取得します。 カウンターが保存されていない場合は 0L を返します。 |
| 3 | 値をインクリメントします。 キーにカウンターが保存されていない場合、 incr コマンドは値を 0 と見なします (したがって、 incr は値を 1 に設定します)。 |
カウンターを操作するのに役立つ他のメソッドもあります。
-
incrby- 増分値 (正または負) を設定できます。 -
incrbyfloat- 増分値を float/double として設定できます (保存される値は double になります)。 -
set- 必要に応じて初期値を設定します。 -
decrおよびdecrby- 保存されている値をデクリメントできます。
5.7. Pub/Sub による通信
Redis を使用すると、チャネルに メッセージ を送信したり、これらのメッセージをリッスンしたりできます。 これらの機能は pubsub グループから利用できます。
次のスニペットは、 キャッシュ が各 set の後に Notification を発行する方法と、サブスクライバーが通知を受信する方法を示しています。
public static final class Notification {
public String key;
public BusinessObject bo;
public Notification() {
}
public Notification(String key, BusinessObject bo) {
this.key = key;
this.bo = bo;
}
}
@ApplicationScoped
@Startup // We want to create the bean instance on startup to subscribe to the channel.
public static class MySubscriber implements Consumer<Notification> {
private final PubSubCommands<Notification> pub;
private final PubSubCommands.RedisSubscriber subscriber;
public MySubscriber(RedisDataSource ds) {
pub = ds.pubsub(Notification.class);
subscriber = pub.subscribe("notifications", this);
}
@Override
public void accept(Notification notification) {
// Receive the notification
}
@PreDestroy
public void terminate() {
subscriber.unsubscribe(); // Unsubscribe from all subscribed channels
}
}
@ApplicationScoped
public static class MyCache {
private final ValueCommands<String, BusinessObject> commands;
private final PubSubCommands<Notification> pub;
public MyCache(RedisDataSource ds) {
commands = ds.value(BusinessObject.class);
pub = ds.pubsub(Notification.class);
}
public BusinessObject get(String key) {
return commands.get(key);
}
public void set(String key, BusinessObject bo) {
commands.set(key, bo);
pub.publish("notifications", new Notification(key, bo));
}
}
5.8. Redis トランザクションの使用
Redis トランザクションは、リレーショナルデータベースのトランザクションとは少し異なります。 Redis トランザクションは、一括して実行されるコマンドのバッチです。
Redis トランザクションは一連のキーを 監視 (watch) することができ、トランザクションの実行中にこれらのキーのいずれかが更新されると、トランザクションを 破棄 (discard) します。
トランザクションにエンキューされたコマンドは、トランザクション全体が実行されるまで実行されません。 つまり、トランザクション中に結果を取得することはできません。 結果は、トランザクションの完了後にアクセスする TransactionResult オブジェクトに蓄積されます。 このオブジェクトには、トランザクションが成功したか破棄されたか、および成功した場合には各コマンドの結果 (コマンド順にインデックス付け) が含まれます。
トランザクションを開始するには、 withTransaction メソッドを使用します。 このメソッドは Consumer<TransactionalRedisDataSource> を受け取ります。これは、コマンドが void (リアクティブバリアントの場合は Uni<Void>) を返す点を除いて、通常の RedisDataSource と同じ API に従います。 そのコンシューマーが制御を戻すと、トランザクションが 実行 されます。
次のスニペットは、 2 つの関連する 書き込み を実行するトランザクションを作成する方法を示しています。
@Inject RedisDataSource ds;
// ...
TransactionResult result = ds.withTransaction(tx -> {
TransactionalHashCommands<String, String, String> hash = tx.hash(String.class);
hash.hset(KEY, "field-1", "hello");
hash.hset(KEY, "field-2", "hello");
});
受け取った tx オブジェクトは、 tx.discard() を使用してトランザクションを 破棄 するためにも使用できます。 返された TransactionResult を使用すると、各コマンドの結果を取得できます。
データソースのリアクティブバリアントを使用する場合、渡されるコールバックは Function<ReactiveTransactionalRedisDataSource, Uni<Void>> です。
@Inject ReactiveRedisDataSource ds;
// ...
Uni<TransactionResult> result = ds.withTransaction(tx -> {
ReactiveTransactionalHashCommands<String, String, String> hash = tx.hash(String.class);
return hash.hset(KEY, "field-1", "hello")
.chain(() -> hash.hset(KEY, "field-2", "hello"));
});
トランザクションの実行は、 キー によって条件付けられます。 トランザクションの実行中に渡されたキーが変更されると、トランザクションは破棄されます。 キーは withTransaction メソッドの 2 番目の可変引数パラメーターに String として渡されます。
TransactionResult result = ds.withTransaction(tx -> {
TransactionalHashCommands<String, String, String> hash = tx.hash(String.class);
hash.hset(KEY, "field-1", "hello");
hash.hset(KEY, "field-2", "hello");
}, KEY);
| トランザクション内から pub/sub 機能を使用することはできません。 |
5.8.1. 楽観的ロックパターンの実装
楽観的ロックを使用するには、トランザクションが開始される前にコードを実行できる withTransaction メソッドのバリアントを使用する必要があります。 言い換えると、以下のように実行されます。
WATCH key
// Pre-transaction block
// ...
// Produce a result
MULTI
// In transaction code, receive the result produced by the pre-transaction block.
EXEC
例えば、フィールドが存在する場合にのみハッシュ内の値を更新する必要がある場合は、次の API を使用します。
OptimisticLockingTransactionResult<Boolean> result = blocking.withTransaction(ds -> {
// The pre-transaction block:
HashCommands<String, String, String> hashCommands = ds.hash(String.class);
return hashCommands.hexists(key, "field"); // Produce a result (boolean in this case)
},
(exists, tx) -> {
// The transactional block, receives the result and the transactional data source
if (exists) {
tx.hash(String.class).hset(key, "field", "new value");
} else {
tx.discard();
}
},
// The watched key
key);
事前トランザクションブロックまたはトランザクションブロックの実行前または実行中に監視対象のキーの 1 つが変更された場合、トランザクションは中止されます。 事前トランザクションブロックは、トランザクションブロックが使用できる結果を生成します。 トランザクション内ではコマンドが結果を生成しないため、この構造が必要です。 結果はトランザクションの実行後にのみ取得できます。
事前トランザクションブロックとトランザクションブロックは、同じ Redis 接続上で呼び出されます。 その結果、事前トランザクションブロックは、渡されたデータソースを使用してコマンドを実行する必要があります。 したがって、コマンドはその接続から発行されます。 これらのコマンドは監視対象のキーを変更してはいけません。
5.8.2. エラーハンドリング
トランザクションブロックが正常に終了した場合 (リアクティブ API の場合はアイテムとともに完了した場合)、トランザクションが実行されます。この場合、一部のトランザクションコマンドが成功し、一部が失敗する可能性がありますが、これは Redis の標準的な動作であることに注意してください。 TransactionResult.hasErrors() メソッドは、少なくとも 1 つのコマンドが失敗したかどうかを示します。 TransactionResult 内の失敗したコマンドの結果は、 Throwable として表されます。トランザクションブロックが例外をスローした場合 (リアクティブ API の場合は失敗で完了した場合)、トランザクションは自動的に破棄され、例外が再スローされます (リアクティブ API の場合は、結果の Uni が同じ失敗で完了します)。
楽観的ロック API の場合、事前トランザクションブロックが正常に終了すると (リアクティブ API の場合はアイテムとともに完了すると)、トランザクションが開始され、処理がトランザクションブロックに進みます。事前トランザクションブロックが例外をスローした場合 (リアクティブ API の場合は失敗で完了した場合)、監視されているすべてのキーが自動的に UNWATCH され、例外が再スローされます (リアクティブ API の場合は、結果の Uni が同じ失敗で完了します)。この場合、トランザクションは開始されず、トランザクションブロックも実行されません。
5.8.3. Redis Cluster におけるトランザクション
クラスターモードでは、トランザクションコマンド ( MULTI, EXEC, DISCARD, WATCH, UNWATCH ) は特別に処理されます。
デフォルトでは、クラスターでのトランザクションは無効になっており、トランザクションコマンドは即座に失敗します。
ただし、 quarkus.redis.cluster-transactions を single-node に設定することで、単一ノードのトランザクションを有効にすることが可能です。この設定はクラスターモードでのみ意味を持ち、それ以外の場合は無視されることに注意してください。
このモードでは、 MULTI コマンドはキューに入れられ、次のコマンドが実行されるときにのみ発行されます。この次のコマンドによって、接続が Redis クラスターの対応するノードにバインドされます (そのため、コマンドはキーを持っている必要があり、持っていない場合のターゲットノードはランダムになります)。以降のすべてのコマンドはそのノードをターゲットとします。それ以降のコマンドの中に別のノードに属するキーを持つものがある場合、そのコマンドはサーバー側で失敗します。 MULTI の前に WATCH が使用されている場合、そのキーによって接続先のノードが決定され、その後の MULTI はキューに入れられません。 WATCH のキーが複数のノードに属している場合、コマンドはクライアント側で失敗します。
5.9. カスタムコマンドの実行
カスタムコマンド、または API でサポートされていないコマンドを実行するには、次のアプローチを使用します。
@Inject ReactiveRedisDataSource ds;
// ...
Response response = ds.execute("my-command", param1, param2, param3);
execute メソッドは Redis にコマンドを送信し、 Response を取得します。最初のパラメーターとしてコマンド名を渡します。コマンドには、任意の数の String パラメーターを追加できます。結果は Response オブジェクトにラップされます。
リアクティブ版は Uni<Response> を返します。
| トランザクション内でカスタムコマンドを実行することもできます。 |
6. Redis へのデータのプリロード
起動時に、Redis データベースにデータをプリロードするように Redis クライアントを構成できます。
6.1. ロードスクリプトの設定
ロードしたい ロードスクリプト を以下を使用して指定します。
quarkus.redis.load-script=import.redis # import.redis is the default in dev mode, no-file is the default in production mode
quarkus.redis.my-redis.load-script=actors.redis, movies.redis
load-script はビルド時プロパティーであり、実行時にオーバーライドすることはできません。
|
各クライアントが異なるスクリプト、さらにはスクリプトのリストを持つことができることに注意してください。リストの場合、データはリストの順序でインポートされます (たとえば、 my-redis クライアントに対して、最初に actors.redis 、次に movies.redis )。
6.2. ロードスクリプトの作成
.redis ファイルは、 1 行に 1 コマンド の形式に従います。
# Line starting with # and -- are ignored, as well as empty lines
-- One command per line:
HSET foo field1 abc field2 123
-- Parameters with spaces must be wrapped into single or double quotes
HSET bar field1 "abc def" field2 '123 456 '
-- Parameters with double quotes must be wrapped into single quotes and the opposite
SET key1 'A value using "double-quotes"'
SET key2 "A value using 'single-quotes'"
Quarkus は単一ファイル内のすべてのコマンドをバッチ処理し、すべてのコマンドを送信します。エラーが発生するとロードプロセスは失敗しますが、それより前の命令は実行されている可能性があります。それを避けるために、コマンドを Redis の トランザクション でラップすることができます。
-- Run inside a transaction
MULTI
SET key value
SET space:key 'another value'
INCR counter
EXEC
6.3. プリロードの設定
データはアプリケーションの起動時にロードされます。デフォルトでは、インポート前にデータベース全体が削除されます。これは quarkus.redis.flush-before-load=false を使用して防ぐことができます。
また、インポートプロセスはデータベースが空 (キーがない状態) の場合にのみ実行されます。 quarkus.redis.load-only-if-empty=false を使用して、データがある場合でも強制的にインポートすることができます。
6.4. プリロード時における開発/テストと本番環境の区別
上述の通り、開発およびテストモードでは、Quarkus は src/main/resources/import.redis を探してデータをインポートしようとします。この動作は 本番 (prod) モードでは無効になりますが、本番環境でもインポートしたい場合は、以下を追加してください。
%prod.quarkus.redis.load-script=import.redis
本番 (prod) モードでインポートする前に、 quarkus.redis.flush-before-load が適切に設定されていることを確認してください。
開発モードで .redis ロードスクリプトの内容を再ロードするには、 %dev.quarkus.vertx.caching=false を追加する必要があります。
|
7. Vert.x Redis クライアントの使用
ハイレベル API に加えて、コード内で Vert.x Redis クライアントを直接使用できます。 Vert.x Redis クライアントのドキュメントは、 Vert.x Web サイト で入手できます。
8. プログラムによる Redis ホストの設定
RedisHostsProvider はプログラムによって Redis ホストを提供します。これにより、他のソースから取得した Redis 接続パスワードなどのプロパティーを設定できます。
|
これは、 application.properties に機密データを保存する必要がなくなるため便利です。 |
@ApplicationScoped
@Identifier("hosts-provider") // the name of the host provider
public class ExampleRedisHostProvider implements RedisHostsProvider {
@Override
public Set<URI> getHosts() {
// do stuff to get the host
String host = "redis://localhost:6379/3";
return Collections.singleton(URI.create(host));
}
}
以下に示すように、ホストプロバイダーを使用して Redis クライアントを設定できます。
quarkus.redis.hosts-provider-name=hosts-provider
9. プログラムによる Redis オプションのカスタマイズ
io.quarkus.redis.client.RedisOptionsCustomizer インターフェースを実装する Bean を公開して、Redis クライアントオプションをカスタマイズできます。この Bean は、設定された Redis クライアントごとに呼び出されます。
@ApplicationScoped
public static class MyExampleCustomizer implements RedisOptionsCustomizer {
@Override
public void customize(String clientName, RedisOptions options) {
if (clientName.equalsIgnoreCase("my-redis")
|| clientName.equalsIgnoreCase(RedisConfig.DEFAULT_CLIENT_NAME)) {
// modify the given options
} else {
throw new IllegalStateException("Unknown client name: " + clientName);
}
}
}
9.1. Redis Dev Services の使用
Redis Dev Service を参照してください。
10. Redis オブザーバビリティの設定
10.1. ヘルスチェックの有効化
quarkus-smallrye-health エクステンションを使用している場合、 quarkus-redis は Redis サーバーへの接続を検証するための readiness probe を自動的に追加します。
そのため、アプリケーションの /q/health/ready エンドポイントにアクセスすると、接続の検証ステータスに関する情報を取得できます。
この動作は、 application.properties で quarkus.redis.health.enabled プロパティーを false に設定することで無効にできます。
10.2. メトリクスの有効化
アプリケーションが quarkus-micrometer エクステンションも使用している場合、Redis クライアントのメトリクスは自動的に有効になります。 Micrometer は、アプリケーションによって実装されたすべての Redis クライアントのメトリクスを収集します。
例として、メトリクスを Prometheus にエクスポートすると、次のようになります。
# HELP redis_commands_duration_seconds The duration of the operations (commands of batches
# TYPE redis_commands_duration_seconds summary
redis_commands_duration_seconds_count{client_name="<default>",} 3.0
redis_commands_duration_seconds_sum{client_name="<default>",} 0.047500042
# HELP redis_commands_duration_seconds_max The duration of the operations (commands of batches
# TYPE redis_commands_duration_seconds_max gauge
redis_commands_duration_seconds_max{client_name="<default>",} 0.033273167
# HELP redis_pool_active The number of resources from the pool currently used
# TYPE redis_pool_active gauge
redis_pool_active{pool_name="<default>",pool_type="redis",} 0.0
# HELP redis_pool_ratio Pool usage ratio
# TYPE redis_pool_ratio gauge
redis_pool_ratio{pool_name="<default>",pool_type="redis",} 0.0
# HELP redis_pool_queue_size Number of pending elements in the waiting queue
# TYPE redis_pool_queue_size gauge
redis_pool_queue_size{pool_name="<default>",pool_type="redis",} 0.0
# HELP redis_commands_failure_total The number of operations (commands or batches) that have been failed
# TYPE redis_commands_failure_total counter
redis_commands_failure_total{client_name="<default>",} 0.0
# HELP redis_commands_success_total The number of operations (commands or batches) that have been executed successfully
# TYPE redis_commands_success_total counter
redis_commands_success_total{client_name="<default>",} 3.0
# HELP redis_pool_idle The number of resources from the pool currently used
# TYPE redis_pool_idle gauge
redis_pool_idle{pool_name="<default>",pool_type="redis",} 6.0
# HELP redis_pool_completed_total Number of times resources from the pool have been acquired
# TYPE redis_pool_completed_total counter
redis_pool_completed_total{pool_name="<default>",pool_type="redis",} 3.0
# HELP redis_commands_count_total The number of operations (commands or batches) executed
# TYPE redis_commands_count_total counter
redis_commands_count_total{client_name="<default>",} 3.0
# HELP redis_pool_usage_seconds Time spent using resources from the pool
# TYPE redis_pool_usage_seconds summary
redis_pool_usage_seconds_count{pool_name="<default>",pool_type="redis",} 3.0
redis_pool_usage_seconds_sum{pool_name="<default>",pool_type="redis",} 0.024381375
# HELP redis_pool_usage_seconds_max Time spent using resources from the pool
# TYPE redis_pool_usage_seconds_max gauge
redis_pool_usage_seconds_max{pool_name="<default>",pool_type="redis",} 0.010671542
# HELP redis_pool_queue_delay_seconds Time spent in the waiting queue before being processed
# TYPE redis_pool_queue_delay_seconds summary
redis_pool_queue_delay_seconds_count{pool_name="<default>",pool_type="redis",} 3.0
redis_pool_queue_delay_seconds_sum{pool_name="<default>",pool_type="redis",} 0.022341249
# HELP redis_pool_queue_delay_seconds_max Time spent in the waiting queue before being processed
# TYPE redis_pool_queue_delay_seconds_max gauge
redis_pool_queue_delay_seconds_max{pool_name="<default>",pool_type="redis",} 0.021926083
Redis クライアント名は タグ の中にあります。
メトリクスには、Redis 接続プールメトリクス ( redis_pool_* ) と、コマンドの実行数、成功数、失敗数、期間などのコマンド実行に関するメトリクス ( redis_commands_* ) の両方が含まれます。
11. 設定リファレンス
ビルド時に固定される設定プロパティー - 他のすべての設定プロパティーは実行時にオーバーライド可能です
Configuration property |
タイプ |
デフォルト |
|---|---|---|
Whether a health check is published in case the smallrye-health extension is present. Environment variable: Show more |
ブーリアン |
|
A list of files allowing to pre-load data into the Redis server. The file is formatted as follows:
Environment variable: Show more |
文字列のリスト |
|
When using Environment variable: Show more |
ブーリアン |
|
When using Environment variable: Show more |
ブーリアン |
|
Whether this Redis Client should be active at runtime. Environment variable: Show more |
ブーリアン |
|
The Redis hosts to use while connecting to the Redis server. Only the cluster and sentinel modes will consider more than 1 element. The URI provided uses the following schema Environment variable: Show more |
list of URI |
|
The hosts provider bean name. It is the Used when Environment variable: Show more |
string |
|
The maximum delay to wait before a blocking command to Redis server times out Environment variable: Show more |
|
|
The Redis client type. Accepted values are: Environment variable: Show more |
|
|
The master name (only considered in the Sentinel mode). Environment variable: Show more |
string |
|
The role name (only considered in the Sentinel mode). Accepted values are: Environment variable: Show more |
|
|
Whether to use replicas nodes (only considered in Cluster mode and Replication mode). Accepted values are: Environment variable: Show more |
|
|
The default password for Redis connections. If not set, it will try to extract the value from the Environment variable: Show more |
string |
|
The maximum size of the connection pool. Environment variable: Show more |
int |
|
The maximum waiting requests for a connection from the pool. Environment variable: Show more |
int |
|
The duration indicating how often should the connection pool cleaner execute. Environment variable: Show more |
|
|
The timeout for unused connection recycling. Environment variable: Show more |
|
|
Sets how many handlers is the client willing to queue. The client will always work on pipeline mode, this means that messages can start queueing. Using this configuration option, you can control how much backlog you’re willing to accept. Environment variable: Show more |
int |
|
Tune how much nested arrays are allowed on a Redis response. This affects the parser performance. Environment variable: Show more |
int |
|
The number of reconnection attempts when a pooled connection cannot be established on first try. Environment variable: Show more |
int |
|
The interval between reconnection attempts when a pooled connection cannot be established on first try. Environment variable: Show more |
|
|
Should the client perform Environment variable: Show more |
ブーリアン |
|
The preferred protocol version to be used during protocol negotiation. When not set, defaults to RESP 3. When protocol negotiation is disabled, this setting has no effect. Environment variable: Show more |
|
|
The TTL of the topology cache. A topology cache is used by a clustered Redis client and a sentinel Redis client to prevent constantly sending topology discovery commands ( This setting is only meaningful in case of a clustered Redis client and a sentinel Redis client and has no effect otherwise. Environment variable: Show more |
|
|
Whether automatic failover is enabled. This only makes sense for sentinel clients with role of If enabled, the sentinel client will additionally create a connection to one sentinel node and watch for failover events. When new master is elected, all connections to the old master are automatically closed and new connections to the new master are created. Automatic failover makes sense for connections executing regular commands, but not for connections used to subscribe to Redis pub/sub channels. Note that there is a brief period of time between the old master failing and the new master being elected when the existing connections will temporarily fail all operations. After the new master is elected, the connections will automatically fail over and start working again. Environment variable: Show more |
ブーリアン |
|
How the Redis topology is obtained. By default, the topology is discovered automatically. This is the only mode for the clustered and sentinel client. For replication client, topology may be set statically. In case of a static topology for replication Redis client, the first node in the list is considered a master and the remaining nodes in the list are considered replicas. Environment variable: Show more |
|
|
How transactions are handled in a cluster. This only makes sense for cluster clients and is ignored otherwise. By default, transactions in cluster are disabled and transaction commands fail. When set to Environment variable: Show more |
|
|
The client name used to identify the connection. If the If the Environment variable: Show more |
string |
|
Whether it should set the client name while connecting with Redis. This is necessary because Redis only accepts This property can be used with Environment variable: Show more |
ブーリアン |
|
The name of the TLS configuration to use. If a name is configured, it uses the configuration from If no TLS configuration name is set then, The default TLS configuration is not used by default. Environment variable: Show more |
string |
|
This property is deprecated since The TTL of the topology cache. A topology cache is used by a clustered Redis client and a sentinel Redis client to prevent constantly sending topology discovery commands ( This setting is only meaningful in case of a clustered Redis client and a sentinel Redis client and has no effect otherwise. Environment variable: Show more |
|
|
Dev Services allows Quarkus to automatically start Redis in dev and test mode |
タイプ |
デフォルト |
If DevServices has been explicitly enabled or disabled. DevServices is generally enabled by default, unless there is an existing configuration present. When DevServices is enabled Quarkus will attempt to automatically configure and start a database when running in Dev or Test mode and when Docker is running. Environment variable: Show more |
ブーリアン |
|
The container image name to use, for container based DevServices providers. If you want to use Redis Stack modules (bloom, graph, search…), use: Environment variable: Show more |
string |
|
Optional fixed port the dev service will listen to. If not defined, the port will be chosen randomly. Environment variable: Show more |
int |
|
Indicates if the Redis server managed by Quarkus Dev Services is shared. When shared, Quarkus looks for running containers using label-based service discovery. If a matching container is found, it is used, and so a second one is not started. Otherwise, Dev Services for Redis starts a new container. The discovery uses the Container sharing is only used in dev mode. Environment variable: Show more |
ブーリアン |
|
The value of the This property is used when you need multiple shared Redis servers. Environment variable: Show more |
string |
|
Environment variables that are passed to the container. Environment variable: Show more |
Map<String,String> |
|
タイプ |
デフォルト |
|
Set the ALPN usage. Environment variable: Show more |
ブーリアン |
|
Sets the list of application-layer protocols to provide to the server during the Environment variable: Show more |
文字列のリスト |
|
Sets the list of enabled SSL/TLS protocols. Environment variable: Show more |
文字列のリスト |
|
Set the idle timeout. Environment variable: Show more |
||
Set the connect timeout. Environment variable: Show more |
||
The name of the proxy configuration to use. If Otherwise, if not set and the default proxy configuration is configured ( Environment variable: Show more |
string |
|
Set the read idle timeout. Environment variable: Show more |
||
Set the TCP receive buffer size. Environment variable: Show more |
int |
|
Set the value of reconnect attempts. Environment variable: Show more |
int |
|
Set the reconnect interval. Environment variable: Show more |
||
Whether to reuse the address. Environment variable: Show more |
ブーリアン |
|
Whether to reuse the port. Environment variable: Show more |
ブーリアン |
|
Set the TCP send buffer size. Environment variable: Show more |
int |
|
Set the Environment variable: Show more |
||
Enable the Environment variable: Show more |
ブーリアン |
|
Enable the Environment variable: Show more |
ブーリアン |
|
Set whether keep alive is enabled Environment variable: Show more |
ブーリアン |
|
Set whether no delay is enabled Environment variable: Show more |
ブーリアン |
|
Enable the Environment variable: Show more |
ブーリアン |
|
Set the value of traffic class. Environment variable: Show more |
int |
|
Set the write idle timeout. Environment variable: Show more |
||
Set the local interface to bind for network connections. When the local address is null, it will pick any local address, the default local address is null. Environment variable: Show more |
string |
|
タイプ |
デフォルト |
|
Whether SSL/TLS is enabled. Environment variable: Show more |
ブーリアン |
|
Enable trusting all certificates. Disabled by default. Environment variable: Show more |
ブーリアン |
|
PEM Trust config is disabled by default. Environment variable: Show more |
ブーリアン |
|
Comma-separated list of the trust certificate files (Pem format). Environment variable: Show more |
文字列のリスト |
|
JKS config is disabled by default. Environment variable: Show more |
ブーリアン |
|
Path of the key file (JKS format). Environment variable: Show more |
string |
|
Password of the key file. Environment variable: Show more |
string |
|
PFX config is disabled by default. Environment variable: Show more |
ブーリアン |
|
Path to the key file (PFX format). Environment variable: Show more |
string |
|
Password of the key. Environment variable: Show more |
string |
|
PEM Key/cert config is disabled by default. Environment variable: Show more |
ブーリアン |
|
Comma-separated list of the path to the key files (Pem format). Environment variable: Show more |
文字列のリスト |
|
Comma-separated list of the path to the certificate files (Pem format). Environment variable: Show more |
文字列のリスト |
|
JKS config is disabled by default. Environment variable: Show more |
ブーリアン |
|
Path of the key file (JKS format). Environment variable: Show more |
string |
|
Password of the key file. Environment variable: Show more |
string |
|
PFX config is disabled by default. Environment variable: Show more |
ブーリアン |
|
Path to the key file (PFX format). Environment variable: Show more |
string |
|
Password of the key. Environment variable: Show more |
string |
|
The hostname verification algorithm to use in case the server’s identity should be checked. Should be If set to Environment variable: Show more |
string |
|
|
期間フォーマットについて
期間の値を書くには、標準の 数字で始まる簡略化した書式を使うこともできます:
その他の場合は、簡略化されたフォーマットが解析のために
|