dynamodb-locked-value
v1.2.0
Published
Utility to create and manage locks in DynamoDB. There are times to share some values between multiple instances of a service. For example, when a token is issued by AWS Lambda functions, you might want to care about rate limits or costs issuing the token
Downloads
18
Readme
dynamodb-lock
Utility to create and manage locks in DynamoDB. There are times to share some values between multiple instances of a service. For example, when a token is issued by AWS Lambda functions, you might want to care about rate limits or costs issuing the token.
Installation
npm install dynamodb-locked-value
Usage
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { getLockedValue } from "dynamodb-locked-value";
const client = new DynamoDBClient({ region: "us-west-2" });
await getLockedValue(client, {
tableName: "TestTable",
hashKeyAttributeName: "key",
hashKey: "token",
now: new Date(),
getNewValue: async () => fetch("https://example.com/token"),
});