Skip to main content

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.

info

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.

info

What's the difference between Momento Leaderboards and a Sorted Set?

Momento Leaderboards has a much more efficient memory footprint, allowing us to scale to tens of millions of records, and the APIs were built with gaming use cases specifically in mind.

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.

Image of Momento console landing page

Click on the Create Cache button and create a cache using the cloud provider and region you want to use for your Momento Leaderboards.

Image of Momento console Create Cache form

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.

Language Support for Momento Leaderboards

Learn more about the SDKs available for different programming languages on our Language Support Page.

Frequently asked questions about Momento Leaderboards

Details

Do Momento Leaderboards items expire? Momento Leaderboards items have a 7-day TTL by default. If the default TTL for leaderboard items doesn’t work for you, reach out to support@momentohq.com to discuss removing limits.