The `amazon-dax-client` package provides a client library for Node.js applications to interact with Amazon DynamoDB Accelerator (DAX), a fully managed caching service. DAX offers high-performance in-memory caching for DynamoDB, significantly boosting read performance by up to 10 times, even at millions of requests per second. This client is API compatible with DynamoDB's AWS SDK v2, allowing for minimal code changes to integrate DAX caching into existing applications. The current stable version, 1.2.10, focuses on optimizing connection clean-up and addressing various connection stability and data parsing issues, indicating an active maintenance and bug-fix release cadence for the v1.x branch. It differentiates itself by providing a seamless caching layer for AWS SDK v2 DynamoDB operations, transparently handling caching logic. For applications utilizing AWS SDK for JavaScript v3, a separate client, `@aws-sdk/client-dax`, is available and features a modular architecture, which represents a significant shift in usage patterns.
npm install amazon-dax-clientVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate the `AmazonDaxClient` and integrate it with the `AWS.DynamoDB.DocumentClient` to perform basic `put` and `get` operations, leveraging DAX for caching. It assumes `aws-sdk` is already installed and configures region and endpoint from environment variables or defaults.
For AWS SDK v3, install `@aws-sdk/client-dax` (`npm install @aws-sdk/client-dax`) and use `import { DAXClient } from '@aws-sdk/client-dax';` for ESM, or `const { DAXClient } = require('@aws-sdk/client-dax');` for CJS.Ensure the client is only used in Node.js environments. For browser-based applications that need to interact with DAX, you would typically route requests through a backend service using the Node.js client or the AWS SDK for JavaScript directly.
Upgrade to `amazon-dax-client` version 1.2.7 or higher to benefit from improved retry logic for `AuthenticationRequiredException`.
Upgrade to `amazon-dax-client` version 1.2.5 or higher to ensure `antlr4` dependency compatibility and avoid potential runtime errors in specific Node.js environments.
Always use the latest 1.2.x version (currently 1.2.10) to benefit from continuous improvements in connection management, timeout handling, and socket leak prevention.
Upgrade to `amazon-dax-client` version 1.2.8 or higher, where this specific error was addressed and fixed.
Upgrade to `amazon-dax-client` version 1.1.3 or higher, which increased the default `connectTimeout` and allowed it to be configurable. Further fixes in 1.1.2 also addressed socket timeouts during connection.
Upgrade to `amazon-dax-client` version 1.2.2 or higher, which includes specific fixes for unrecoverable request timeouts and connection timeouts during DAX server restarts.
Upgrade to `amazon-dax-client` version 1.1.4, 1.1.2, 1.1.1, or later for fixes addressing connection and socket leaks in various error scenarios. The latest 1.2.10 includes further optimizations for connection clean-up.