SDK Client configuration objects
Configuration objects contain the settings necessary for how a Momento client should connect to Momento services. The Configuration object controls settings such as timeouts, retries, logging, middleware, read concern, and more.
Each SDK contains pre-built Configuration objects to help get you up and running as quickly as possible. We did the hard work of tuning for various deployment environments so you can focus on the things unique to your business. (We even have a blog series about it! Shockingly simple: Cache clients that do the hard work for you)
Pre-built configurations come with a latest() version, which will always give you the latest recommended configuration for a given environment. For example,
- JavaScript
- Rust
The latest() pre-built configuration may change between SDK releases as we continue to test, tune, and deliver better settings. If you would like to ensure your configuration does not change with an SDK upgrade, we provide fixed versions such as v1(), which are guaranteed to remain static from one release to the next. For example,
- JavaScript
Configurations.InRegion.Default.v1();
If you need a custom configuration, you can build your own Configuration object. See the examples in the Configurations namespace in the source code of each SDK to see how they are constructed.
We hope these configurations will meet the needs of most use cases, but if you find them lacking in any way, please open a GitHub issue on that SDK repo, or contact us at support@momentohq.com. We would love to hear about your use case so we can fix or extend the pre-built configurations to better support you.
Pre-built configurations
Here are some of the pre-built configurations that you might be interested in.
Laptop
Configurations.Laptop is a development environment, just for poking around on your... laptop :) It has relaxed timeouts and assumes your network latencies might be a bit high.
- JavaScript
- Java
- Kotlin
- Rust
Configurations.Laptop.v1();
Configurations.Laptop.v1();
Configurations.Laptop.latest
let config = momento::cache::configurations::Laptop::latest();
Browser
Configurations.Browser is a configuration unique to our web SDK. It has relaxed timeout settings since latencies can be highly variable in individual users' browsers.
InRegion - Default
Configurations.InRegion.Default is the recommended configuration for most server-side use cases, where you send requests to Momento services from your apps hosted in the same cloud provider Region. It has more aggressive timeouts and retry behavior than the Laptop config, so it will fail faster and allow your application to fall back to your database or other data source more quickly. This helps ensure your applications don't bottleneck on Momento during a network or service interruption.
- JavaScript
Configurations.InRegion.Default.v1();