SDKクライアントConfigurationオブジェクト
Configuration
オブジェクトには、Momento クライアントが Momento サービスに接続するために必要な設定が含まれます。Configuration
オブジェクトは、タイムアウト、再試行、ロギング、ミドルウェア、[read concern] (../../learn/how--it-works/read-concern) などの設定を制御します。
各SDKには、できるだけ早く立ち上げて実行できるように、あらかじめConfiguration
オブジェクトが含まれています。様々なデプロイ環境に対応するためのチューニングは私たちが行います。(それについてのブログシリーズもあります!衝撃的なほどシンプル:あなたのために大変な仕事をするキャッシュクライアント)
ビルド済みのコンフィ ギュレーションには latest()
バージョンが付属しており、与えられた環境に対して常に最新の推奨コンフィギュレーションを提供します。例えば
- JavaScript
- Rust
Configurations.InRegion.Default.latest();
let _config = momento::cache::configurations::InRegion::latest();
allow(non_snake_case)]
b fn example_API_ConfigurationInRegionLowLatency() {
let _config = momento::cache::configurations::LowLatency::latest();
allow(non_snake_case)]
b fn example_API_ConfigurationLambdaLatest() {
let _config = momento::cache::configurations::Lambda::latest();
allow(non_snake_case)]
b fn example_API_InstantiateCacheClient() -> Result<(), MomentoError> {
let _cache_client = CacheClient::builder()
.default_ttl(Duration::from_secs(60))
.configuration(Laptop::latest())
.credential_provider(CredentialProvider::from_env_var(
"MOMENTO_API_KEY".to_string(),
)?)
.build()?;