Skip to content

Latest commit

 

History

History

logo

project status project stability

Node.js Client SDK - Basic cache Examples

Read this in other languages: 日本語


Example Requirements

  • Node version 16 or higher is required
  • To get started with Momento you will need a Momento API key. You can get one from the Momento Console.

To run any of the examples you will need to install the dependencies once first:

npm install

Running the Basic Example

This example demonstrates a basic set and get from a cache.

# Run example code
MOMENTO_API_KEY=<YOUR API KEY> npm run basic

Example Code: basic.ts

Running the Advanced Example

This example demonstrates several slightly more advanced concepts, including:

  • creating and listing caches
  • deleting a key
  • issuing multiple concurrent get requests
  • using the Middleware API to wrap requests
# Run example code
MOMENTO_API_KEY=<YOUR API KEY> npm run advanced

Example Code: advanced.ts

Running the Dictionary Example

This example demonstrates how to use the dictionary data type.

# Run example code
MOMENTO_API_KEY=<YOUR API KEY> npm run dictionary

Example Code: dictionary.ts

Running the BatchUtils Example

This example demonstrates how to use the batchSet, batchGet, and batchDelete functions.

# Run example code
MOMENTO_API_KEY=<YOUR API KEY> npm run batchutils

Running the Leaderboard Example

This example demonstrates how to use the Leaderboard functions.

# Run example code
MOMENTO_API_KEY=<YOUR API KEY> npm run leaderboard

If you have questions or need help experimenting further, please reach out to us!


For more info, visit our website at https://gomomento.com!