New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@gomomento/sdk

Package Overview
Dependencies
Maintainers
1
Versions
220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gomomento/sdk

Client SDK for Momento services

  • 0.8.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.2K
increased by0.01%
Maintainers
1
Weekly downloads
 
Created
Source

Momento client-sdk-javascript

:warning: Experimental SDK :warning:

JavaScript SDK for Momento is experimental and under active development. There could be non-backward compatible changes or removal in the future. Please be aware that you may need to update your source code with the current version of the SDK when its version gets upgraded.



JavaScript SDK for Momento, a serverless cache that automatically scales without any of the operational overhead required by traditional caching solutions.


Getting Started :running:

Requirements

  • Node version 10.13 or higher is required
  • A Momento Auth Token is required, you can generate one using the Momento CLI

Installing Momento and Running the Example

Check out our JavaScript SDK example repo!


Using Momento

import {SimpleCacheClient, CacheGetStatus} from '@gomomento/sdk';

// your authentication token for momento
const authToken = process.env.MOMENTO_AUTH_TOKEN;

// initializing momento
const DEFAULT_TTL = 60; // 60 seconds for default ttl
const momento = new SimpleCacheClient(authToken, DEFAULT_TTL);

// creating a cache named "myCache"
const CACHE_NAME = 'myCache';
await momento.createCache(CACHE_NAME);

// sets key with default ttl
await momento.set(CACHE_NAME, 'key', 'value');
const res = await momento.get(CACHE_NAME, 'key');
console.log('result: ', res.text());

// sets key with ttl of 5 seconds
await momento.set(CACHE_NAME, 'key2', 'value2', 5);

// permanently deletes cache
await momento.deleteCache(CACHE_NAME);

Running Tests :zap:

Integration tests require an auth token for testing. Set the env var TEST_AUTH_TOKEN to provide it.

export TEST_AUTH_TOKEN=<YOUR_AUTH_TOKEN>
npm run integration

FAQs

Package last updated on 01 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc