0.2.3 • Published 1 year ago

@gomomento-poc/aws-cache-helpers v0.2.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

aws-cache-helpers

Various collection of JS utilities to help you enable caching with Momento in AWS.

image

Usage

AWS JS SDK v3 Middleware

import {NewCachingMiddleware} from '@gomomento-poc/aws-cache-helpers';

const authToken = 'REPLACE_ME';
const db = DynamoDBDocumentClient.from(new DynamoDBClient({}));
db.middlewareStack.use(NewCachingMiddleware({
    tableName: 'my-ddb-table',
    momentoAuthToken: authToken,
    defaultCacheTtl: 86400,
    cacheName: 'default'
  }
));

AWS DynamoDB Stream Lambda Handler

import {NewStreamCacheHandler} from '@gomomento-poc/aws-cache-helpers';

const authToken = 'REPLACE_ME';
export const handler = NewStreamCacheHandler({
  tableName: 'my-ddb-table',
  momentoAuthToken: authToken,
  defaultCacheTtl: 86400,
  cacheName: 'default' 
});