Redis extension reference guide
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 クライアントドキュメント を参照してください。2 つの API (
io.vertx.redis.client.Redisおよびio.vertx.redis.client.RedisAPI) が公開されています。接続を自分で管理する必要がある場合を除き、通常は後者を利用することになります。 -
Vert.x API の 低レベルの Mutiny バリアント :以前のものとは異なり、Mutiny API を公開し、リアクティブ型と命令型の両方のメソッド (接尾辞は
andAwait()) が提供されます。2 つの API (io.vertx.mutiny.redis.client.Redisおよびio.vertx.mutiny.redis.client.RedisAPI) が公開されています。自分で接続を管理する必要がある場合を除いて、通常は後者を使用します。 -
高レベルの リアクティブデータソース: Redis と対話するための、タイプセーフな高レベル API です。この API は完全にリアクティブで非同期です。これは、Mutiny API を公開します。
io.quarkus.redis.datasource.ReactiveRedisDataSourceインターフェイスを公開します。 -
高レベルの 命令型データソース: Redis と対話するための、タイプセーフな高レベル API です。これはリアクティブデータソースの命令型バリアントです。
io.quarkus.redis.datasource.RedisDataSourceインターフェイスを公開します。
適切な API を選択できるように、いくつかの推奨事項を以下に示します。
-
Redis と統合する命令型 (classic) の 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. Inject the default and named clients
このエクステンションでは、デフォルトの Redis クライアント/データソースまたは 名前付き ソースを設定することができます。後者は、複数の Redis インスタンスに接続する必要がある場合に不可欠となります。
デフォルトの接続は、 quarkus.redis.* プロパティーを使用して設定されます。たとえば、デフォルトの Redis クライアントを設定するには、以下を使用します。
quarkus.redis.hosts=redis://localhost/
デフォルトの接続を使用する場合、プレーン @Inject を使用してさまざまな APIS を注入することができます。
@ApplicationScoped
public class RedisExample {
@Inject ReactiveRedisDataSource reactiveDataSource;
@Inject RedisDataSource redisDataSource;
@Inject RedisAPI redisAPI;
// ...
}
| In general, you inject a single one; the previous snippet is just an example. |
名前付き クライアントは 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;
// ...
}
You can omit the @Inject annotation when using @RedisClientName.
|
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 (高可用性モードで Redis を使用する場合)。
-
クラスター (Redis を Clustered モードで動作させる場合)。
-
レプリケーション (シングルシャード、1 ノード書き込み、マルチ読み取り)。
接続 URL は、以下のように quarkus.redis.hosts (または quarkus.redis.<name>.hosts) で設定されます。
quarkus.redis.hosts=redis://[:password@]host[:port][/db-number]
4.1. Unixソケットの使用
unix-socket を使用する場合、以下が必要です。
quarkus.redis.hosts=unix://[:password@]/domain/docker.sock[?select=db-number]
4.2. Sentinel モードの使用
Sentinel を使用する場合、複数の ホスト urls を渡し、クライアントのタイプを 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. クラスターモードの使用
Redis をクラスターモードで使用する場合、複数の ホスト urls を渡し、クライアントのタイプを 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. レプリケーションモードの使用
レプリケーションモードを使用する場合、単一のホスト 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. 静的トポロジー
レプリケーションモードでは、Redis クライアントを再設定してトポロジーの自動検出をスキップできます。
quarkus.redis.topology=static
静的トポロジーでは、設定内の最初のノードは マスター ノードと見なされ、残りのノードは レプリカ と見なされます。 ノードは検証されません。アプリケーション開発者が責任を持って、静的設定が正しいことを確認するようにしてください。
通常は、トポロジーの自動検出が優先されることに注意してください。 静的設定は必要な場合にのみ使用してください。 そのようなケースの 1 つが、Amazon Elasticache for Redis (クラスターモードが無効) です。
-
マスターノードは プライマリーエンドポイント に設定し、
-
1 つのレプリカノードを リーダーエンドポイント に設定する必要があります。
| Note that the reader endpoint of Elasticache for Redis (Cluster Mode Disabled) is a domain name which resolves to a CNAME record that points to one of the replicas. The CNAME record to which the reader endpoint resolves changes over time. This form of DNS-based load balancing does not work well with DNS resolution caching and connection pooling. As a result, some replicas are likely to be underutilized. |
4.5. Redisクラウドに接続
redis クラウドに接続するためには、以下のプロパティーが必要です。
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://(2つのs) で始まるようにします。
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
The default hostname verifier is set to NONE, meaning it does not verify the host name. You can change this behavior by setting the quarkus.redis.tls.hostname-verification-algorithm property, to HTTPS for example.
|
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 (generic) -
.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()(requires the RedisJSON module on the server side) -
bloom -
.bloom()(requires the RedisBloom module on the server side) -
cuckoo -
.cuckoo()(requires the RedisBloom module on the server side, which also provides the cuckoo filter commands) -
count-min -
.countmin()(requires the RedisBloom module on the server side, which also provides the count-min filter commands) -
top-k -
.topk()(requires the RedisBloom module on the server side, which also provides the top-k filter commands) -
graph -
.graph()(requires the RedisGraph module on the server side). These commands are marked as experimental. Also the module has been declared end of life by Redis. -
search -
.search()(requires the RedisSearch module on the server side). -
auto-suggest -
.autosuggest()(requires the RedisSearch module on the server side). -
time-series -
.timeseries()(requires the Redis Time Series module on the server side).
これらのコマンドは、stableになる前にフィードバックを必要とするため、experimentalとしてマークされています。
これらのメソッドはそれぞれ、そのグループに関連するコマンドを実行することができるオブジェクトを返します。以下のスニペットは、ハッシュ グループの使い方を示しています。
@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);
}
}
| You cannot use type references when using transaction. This is a known limitation. |
5.6. Manipulate cached and binary data with the value group
value グループは Redis 文字列 を操作するために使用されます。したがって、このグループは Java の文字列に限定されることなく、整数 (カウンターなど) やバイナリーコンテンツ (イメージなど) にも使用することができます。
5.6.1. キャッシュされた値を扱う
Redis をキャッシュとして使用するには、 setex コマンドを使用します。このコマンドは、指定したキーに指定した値を指定した期間だけ格納します。以下のスニペットは、このようなコマンドを使用して 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 メソッドは、指定したキーに対応する値が格納されていない場合に、値を設定するためだけに使用することができます。
The key group provides more fine-grain control on expiration and ttl of each key.
|
|
|
5.6.2. バイナリーデータの格納
Redis の 文字列 は、イメージのようなバイナリーデータを格納するために使用することができます。この場合、値のタイプとして 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 トランザクションはキーのセットを 監視 することができ、トランザクションの実行中にこれらのキーのいずれかが更新された場合、トランザクションを 破棄 します。
トランザクション内でキューに入れられたコマンドは、トランザクション全体が実行される前に実行されることはありません。つまり、トランザクションの最中に結果を取得することはできません。結果はトランザクションの完了後にアクセスする 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);
| You cannot use the pub/sub feature from within a transaction. |
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> を返します。
| You can also execute custom command in a transaction. |
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 is a build time property than cannot be overridden at runtime.
|
各クライアントは異なるスクリプトを持つことができ、スクリプトのリストを持つこともできることに注意してください。リストの場合、データはリストの順番でインポートされます(たとえば、最初に actors.redis 、次に my-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は、1つのファイルからすべてのコマンドを一括して送信します。読み込み処理はエラーがあると失敗しますが、前の命令が実行されている可能性があります。それを避けるために、コマンドを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. プリロード時の開発/テストと実稼働の区別
上記のように、devやtestモードでは、Quarkusは src/main/resources/import.redis を探してデータをインポートしようとします。この動作は prod モードでは無効になっており、実稼働環境でもインポートしたい場合は、以下を追加します:
%prod.quarkus.redis.load-script=import.redis
prod モードでインポートする前に、 quarkus.redis.flush-before-load を適切に設定してください。
In dev mode, to reload the content of the .redis load scripts, you need to add: %dev.quarkus.vertx.caching=false
|
7. Vert.x redisクライアントの使用
高レベルの API に加えて、Vertx 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 オプションのカスタマイズ
Redis クライアントのオプションをカスタマイズするために、 io.quarkus.redis.client.RedisOptionsCustomizer インターフェイスを実装した Bean を公開することができます。この 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 ヘルスチェックを自動的に追加します。
そのため、アプリケーションの /q/health/ready エンドポイントにアクセスすると、接続の検証状況に関する情報が表示されます。
この動作は、 application.properties の quarkus.redis.health.enabled プロパティーを false に設定することで無効にできます。
10.2. メトリクスの有効化
Redisクライアント・メトリクスは、アプリケーションが quarkus-micrometer エクステンションを使用している場合は、自動的に有効になります。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 |
boolean |
|
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 |
boolean |
|
When using Environment variable: Show more |
boolean |
|
Whether this Redis Client should be active at runtime. Environment variable: Show more |
boolean |
|
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 |
boolean |
|
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 有効にすると、sentinel クライアントは 1 つの sentinel ノードへの接続を追加で作成し、フェイルオーバーイベントを監視します。 新しいマスターが選出されると、古いマスターへのすべての接続が自動的に閉じられ、新しいマスターへの新しい接続が作成されます。 自動フェイルオーバーは、通常のコマンドを実行する接続には意味がありますが、Redis pub/sub チャネルをサブスクライブするために使用される接続には意味がありません。 古いマスターが失敗してから新しいマスターが選出されるまでの短期間に、既存の接続ですべての操作が一時的に失敗する天に注意してください。 新しいマスターが選出されると、接続は自動的にフェイルオーバーされ、再び動作を開始します。 Environment variable: Show more |
boolean |
|
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 |
boolean |
|
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 |
boolean |
|
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 |
boolean |
|
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 |
boolean |
|
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 |
boolean |
|
Whether to reuse the port. Environment variable: Show more |
boolean |
|
Set the TCP send buffer size. Environment variable: Show more |
int |
|
Set the Environment variable: Show more |
||
Enable the Environment variable: Show more |
boolean |
|
Enable the Environment variable: Show more |
boolean |
|
Set whether keep alive is enabled Environment variable: Show more |
boolean |
|
Set whether no delay is enabled Environment variable: Show more |
boolean |
|
Enable the Environment variable: Show more |
boolean |
|
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 |
boolean |
|
Enable trusting all certificates. Disabled by default. Environment variable: Show more |
boolean |
|
PEM Trust config is disabled by default. Environment variable: Show more |
boolean |
|
Comma-separated list of the trust certificate files (Pem format). Environment variable: Show more |
文字列のリスト |
|
JKS config is disabled by default. Environment variable: Show more |
boolean |
|
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 |
boolean |
|
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 |
boolean |
|
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 |
boolean |
|
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 |
boolean |
|
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 |
|
|
期間フォーマットについて
期間の値を書くには、標準の 数字で始まる簡略化した書式を使うこともできます:
その他の場合は、簡略化されたフォーマットが解析のために
|