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 Elixir client library.
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
- Elixir SDK Documentation: https://docs.momentohq.com/sdks/elixir
- Discuss: Momento Discord
The Momento Elixir SDK is available on Hex.
alias Momento.CacheClient
config = Momento.Configurations.Laptop.latest()
credential_provider = Momento.Auth.CredentialProvider.from_env_var!("MOMENTO_AUTH_TOKEN")
default_ttl_seconds = 60.0
client = CacheClient.create!(config, credential_provider, default_ttl_seconds)
cache_name = "cache"
case CacheClient.create_cache(client, cache_name) do
{:ok, _} -> :ok
:already_exists -> :ok
{:error, error} -> raise error
end
{:ok, _} = CacheClient.set(client, cache_name, "foo", "bar")
case CacheClient.get(client, cache_name, "foo") do
{:ok, hit} -> IO.puts("Got value: #{hit.value}")
:miss -> :ok
{:error, error} -> raise error
end
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!