Momento Cache is a fast, simple, pay-as-you-go caching solution without any of the operational overhead required by traditional caching solutions. This repo contains the source code for the Momento client library for Kotlin.
To get started with Momento you will need a Momento Auth Token. You can get one from the Momento Console.
- Website: https://www.gomomento.com/
- Momento Documentation: https://docs.momentohq.com/
- Getting Started: https://docs.momentohq.com/getting-started
- Momento SDK Documentation for Kotlin: https://docs.momentohq.com/sdks/kotlin
- Discuss: Momento Discord
The Kotlin SDK is available on Maven Central:
dependencies {
implementation("software.momento.kotlin:sdk:0.1.3")
}
<dependency>
<groupId>software.momento.kotlin</groupId>
<artifactId>sdk</artifactId>
<version>0.1.3</version>
</dependency>
package software.momento.example.doc_examples
import kotlinx.coroutines.runBlocking
import software.momento.kotlin.sdk.CacheClient
import software.momento.kotlin.sdk.auth.CredentialProvider
import software.momento.kotlin.sdk.config.Configurations
import software.momento.kotlin.sdk.responses.cache.GetResponse
import kotlin.time.Duration.Companion.seconds
fun main() = runBlocking {
CacheClient(
CredentialProvider.fromEnvVar("MOMENTO_API_KEY"),
Configurations.Laptop.latest,
60.seconds
).use { client ->
val cacheName = "cache"
client.createCache(cacheName)
client.set(cacheName, "key", "value")
when (val response = client.get(cacheName, "key")) {
is GetResponse.Hit -> println("Hit: ${response.value}")
is GetResponse.Miss -> println("Miss")
is GetResponse.Error -> throw response
}
}
}
Documentation is available on the Momento Docs website.
Working example projects, with all required build configuration files, are available in the examples subdirectory.
If you are interested in contributing to the SDK, please see the CONTRIBUTING docs.
For more info, visit our website at https://gomomento.com!