Momento Leaderboards Documentation
What is Momento Leaderboards?
Momento Leaderboards is a serverless leaderboard service that supports tens of millions of items and rapid ingestion/querying/updates. While many databases approximate leaderboards via general purpose data structures like sorted set or range queries, Momento Leaderboard is a first-class, full-fledged service that you can quickly and easily integrate with your application.
Leaderboard items will have a 7-day TTL by default. For persistence (unlimited TTL), please contact our team through the contact form, on Discord, or by emailing support@momentohq.com.
Getting Started with Momento Leaderboards
Step 1: Create your Momento API key and cache
Go to the Momento console and follow the instructions to log in with your email address, Google account, or GitHub account.
Click on the Create Cache button and create a cache using the cloud provider and region you want to use for your Momento Leaderboards.
Then follow our step-by-step instructions to create an API key via the Momento console.
Step 2: Create a Momento Leaderboards
// Create a new leaderboard client, which you can use to create
// as many leaderboards as you wish
const client = new PreviewLeaderboardClient({
configuration: LeaderboardConfigurations.Laptop.v1(),
credentialProvider: CredentialProvider.fromEnvironmentVariable({
environmentVariableName: 'MOMENTO_API_KEY',
}),
});
// Create a new leaderboard with the given cache and leaderboard name
const leaderboard = client.leaderboard('my-cache', 'my-leaderboard');
Step 3: Upsert, fetch, and remove elements
See the API reference page for documentation on each available leaderboard API.
Check out the Node.js example for a runnable program that includes examples of how to call each API.