@gomomento-poc/aws-cache-helpers
v0.2.3
Published
Small proof of concept libraries to help you enable caching in AWS
Downloads
20
Readme
aws-cache-helpers
Various collection of JS utilities to help you enable caching with Momento in AWS.
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'
});