Package Exports
- @amazon-dax-sdk/client-dax
- @amazon-dax-sdk/client-dax/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@amazon-dax-sdk/client-dax) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Amazon DAX Client for JavaScript
DAX is a DynamoDB-compatible caching service that enables you to benefit from fast in-memory performance for demanding applications.
Overview
This client library provides access from NodeJS to DAX.
Installing
The Amazon DAX client only runs from NodeJS, and can be installed using npm:
npm install @amazon-dax-sdk/client-dax
Usage and Getting Started
You can follow the Getting Started tutorial at:
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.client.sample-app.html
To quickly use DAX, replace DynamoDB
full client with Dax
:
import { Dax } from '@amazon-dax-sdk/client-dax';
import { DynamoDB } from '@aws-sdk/client-dynamodb';
// Replace this ...
var client = new DynamoDB({region: region});
// with this ...
const endpoint = "your-cluster-discovery-endpoint";
client = new Dax({endpoints: [endpoint], region: region});
The DAX Cluster Discovery Endpoint can be found in the AWS console or by using aws dax describe-clusters
from the command line.
Creating a connection to your DAX cluster requires using the Cluster Discovery Endpoint URL returned in the DescribeClusters response as the endpoint.
For example:
// Format: const endpoint = <ClusterDiscoveryEndpoint.URL>;
const endpoint = 'dax://my-cluster.abc123.dax-clusters.us-east-1.amazonaws.com';
// Encrypted Cluster Endpoint
const endpoint = 'daxs://my-cluster.abc123.dax-clusters.us-east-1.amazonaws.com';
Calling Operations
import { Dax } from '@amazon-dax-sdk/client-dax';
import { DynamoDB } from '@aws-sdk/client-dynamodb';
// Override Client ...
var client = new DynamoDB({region: region});
// with this ...
const endpoint = "your-cluster-discovery-endpoint";
client = new Dax({endpoints: endpoint, region: region});
var params = {
TableName: 'TryDaxTable',
pk: {N: '1'},
sk: {S: '1'}
}
// Similarly for other data plane calls
client.getItem(params).then((res)=>{
console.log(res);
}).catch(err=>{
throw err;
});
Getting Help
Please use these community resources for getting help.
- Ask a question on StackOverflow and tag it with
amazon-dynamodb-dax
- Ask a question on the AWS DynamoDB forum
- Open a support ticket with AWS Support
Changes
3.0.2
- Added support to limit concurrent connections that a client instance can create per node in DAX cluster
3.0.1
- Initial release