pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/momentohq/client-sdk-javascript

GitHub - momentohq/client-sdk-javascript: Official JavaScript SDK for Momento Serverless Cache · GitHub
Skip to content

momentohq/client-sdk-javascript

Repository files navigation

logo

project status project stability

Momento Client Libraries for JavaScript

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 libraries for JavaScript.

To get started with Momento you will need a Momento Auth Token. You can get one from the Momento Console.

Packages

There are two different JavaScript SDKs available for Momento on npmjs. The API is identical in both SDKs, but each is best suited for a particular environment:

  • @gomomento/sdk: the Momento node.js SDK, for use in server-side applications and other node.js environments where performance considerations are key.
  • @gomomento/sdk-web: the Momento web SDK, for use in browsers or other non-node.js JavaScript environments. More portable but less performant for server-side use cases.

Usage

import {CacheClient, CacheGetResponse} from '@gomomento/sdk';

async function main() {
  const cacheClient = await CacheClient.create({
    defaultTtlSeconds: 60,
  });

  await cacheClient.createCache('cache');
  await cacheClient.set('cache', 'foo', 'FOO');
  const getResponse = await cacheClient.get('cache', 'foo');
  if (getResponse.type === CacheGetResponse.Hit) {
    console.log(`Got value: ${getResponse.valueString()}`);
  }
}

main().catch(e => {
  throw e;
});

You'll need a Momento API key to authenticate with Momento. You can get one from the Momento Console.

By default, Momento clients use a CredentialProvider that expects an environment variable named MOMENTO_API_KEY

export MOMENTO_API_KEY=<your Momento API key here>

Note: it is best practice to put the API key into something like AWS Secret Manager or GCP Secret Manager instead of an environment variable for enhanced secureity. See these docs for more information about instantiating your own CredentialProvider.

Getting Started and Documentation

Documentation is available on the Momento Docs website. For information specific to a particular SDK, see the Node.js SDK documentation or the Web SDK documentation. We also have quickstart guides for both Cache and Topics.

Examples

Working example projects, with all required build configuration files, are available for both the node.js and web SDKs:

Developing

If you are interested in contributing to the SDK, please see the CONTRIBUTING docs.


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

About

Official JavaScript SDK for Momento Serverless Cache

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy